Integrate and Classify Normal Distributions · Getting started

Tools to integrate normal (Gaussian) distributions in any dimensions with any parameters within any domain, compute pdf/cdf/inverse cdf of any function of a normal vector, and compute quantities concerning classification performance among two or more multinormals, such as error matrix and discriminability d'.
For function help, type:
doc integrate_normal
doc classify_normals
doc classify_normals_multi
doc norm_fun_cdf
doc norm_fun_pdf
doc norm_fun_inv
If you use this toolbox, please cite: A method to integrate and classify normal distributions. Some examples marked here are described in the paper.
Bugs/questions/comments to abhranil.das@utexas.edu.
Abhranil Das, Center for Perceptual Systems, University of Texas at Austin

Integrate normal in 1d

Define normal parameters, and a quadratic function of it, -x^2+x+1, i.e. q(x)= -1*x^2 + 1*x + 1:
mu=-2; v=3;
quad.q2=-1;
quad.q1=1;
quad.q0=1;

Integrate the normal probability in the quadratic domain defined by q(x)>0:

p=integrate_normal(mu,v,quad)
p = 0.1941
Most plots can be zoomed and panned.

pdf/cdf/inverse cdf of q(x)

p=norm_fun_cdf([0 1 2],mu,v,quad)
p = 1×3
0.8059 0.9175 1.0000
f=norm_fun_pdf([0 1 2],mu,v,quad)
f = 1×3
0.0865 0.1696 0
fplot(@(x) norm_fun_pdf(x,mu,v,quad),[-30 5]); ylabel 'pdf'
% 1st, 2nd and 3rd quartiles
x=norm_fun_inv([0.25 0.5 0.75],mu,v,quad)
x = 1×3
-12.2134 -5.0417 -0.7030

normal probability in the domain defined by a non-quadratic function f(x) =\cos x^2>0

fun=@(x) cos(x.^2);
[p,pc,bd_pts]=integrate_normal(mu,v,fun,'dom_type','fun','fun_span',5,'fun_resol',500)
p = 0.5803
pc = 0.4197
bd_pts = 1×100
-10.5606 -10.4108 -10.2588 -10.1045 -9.9479 -9.7887 -9.6269 -9.4623 -9.2948 -9.1243 -8.9505 -8.7732 -8.5923 -8.4075 -8.2185 -8.0251 -7.8269 -7.6236 -7.4147 -7.1997 -6.9782 -6.7493 -6.5124 -6.2666 -6.0107 -5.7434 -5.4631 -5.1675 -4.8541 -4.5189 -4.1568 -3.7599 -3.3160 -2.8025 -2.1708 -1.2533 1.2533 2.1708 2.8025 3.3160 3.7599 4.1568 4.5189 4.8541 5.1675 5.4631 5.7434 6.0107 6.2666 6.5124

pdf of f(x)

x=linspace(-2,2,100);
f=norm_fun_pdf(x,mu,v,fun,'fun_span',5,'fun_resol',500,'dx',1e-2);
plot(x,f); ylabel 'pdf'

cdf of f(x)

F=norm_fun_cdf(x,mu,v,fun,'fun_span',5,'fun_resol',500);
plot(x,F); ylabel 'cdf'

Inverse cdf of f(x)

p=[0.5 0.75]; % median and 3rd quartile
x=norm_fun_inv(p,mu,v,fun)
x = 1×2
0.2803 0.8832

Classify in 1d

mu_1=0; v_1=1;
mu_2=2.5; v_2=1.5;
results=classify_normals([mu_1,v_1],[mu_2,v_2])
results = struct with fields:
norm_bd: [1×1 struct] norm_bd_pts: [-11.2223 1.2223] norm_errmat: [2×2 double] norm_err: 0.1296 norm_dprime: 2.2565 norm_maha_dprime: 2.2361

with unequal priors and outcome values

results=classify_normals([mu_1,v_1],[mu_2,v_2],'prior_1',.7,'vals',[3 0; 0 1])
results = struct with fields:
norm_bd: [1×1 struct] norm_bd_pts: [-12.0987 2.0987] norm_errmat: [2×2 double] norm_err: 0.1240 norm_valmat: [2×2 double] norm_val: 2.2509

Classify in 1d using samples

Priors are assumed prop. to sample sizes.
mu_1=0; v_1=1;
samp_1=normrnd(mu_1,sqrt(v_1),[700 1]);
mu_2=1.5; v_2=1.5;
samp_2=normrnd(mu_2,sqrt(v_2),[300 1]);
results=classify_normals(samp_1,samp_2,'input_type','samp')
Iteration Func-count min f(x) Procedure 0 1 -813 1 4 -816 initial simplex 2 6 -817 reflect 3 8 -818 reflect 4 13 -818 shrink 5 14 -818 reflect 6 16 -818 contract inside 7 18 -818 contract inside 8 20 -818 contract inside 9 25 -818 shrink 10 30 -818 shrink 11 35 -818 shrink 12 40 -818 shrink 13 45 -818 shrink 14 50 -818 shrink 15 55 -818 shrink 16 60 -818 shrink 17 65 -818 shrink 18 70 -818 shrink 19 75 -818 shrink 20 80 -818 shrink 21 85 -818 shrink 22 90 -818 shrink 23 95 -818 shrink 24 100 -818 shrink 25 105 -818 shrink 26 110 -818 shrink 27 115 -818 shrink 28 120 -818 shrink 29 125 -818 shrink 30 130 -818 shrink 31 135 -818 shrink 32 140 -818 shrink 33 145 -818 shrink 34 150 -818 shrink 35 155 -818 shrink 36 160 -818 shrink 37 165 -818 shrink 38 170 -818 shrink 39 175 -818 shrink 40 180 -818 shrink 41 185 -818 shrink 42 190 -818 shrink 43 195 -818 shrink 44 200 -818 shrink 45 205 -818 shrink 46 210 -818 shrink 47 215 -818 shrink 48 220 -818 shrink 49 225 -818 shrink 50 230 -818 shrink 51 235 -818 shrink Optimization terminated: the current x satisfies the termination criteria using OPTIONS.TolX of 0.000000e+00 and F(X) satisfies the convergence criteria using OPTIONS.TolFun of 1.000000e-03
results = struct with fields:
norm_bd: [1×1 struct] norm_bd_pts: [-8.4926 1.4010] norm_errmat: [2×2 double] norm_err: 0.1888 samp_errmat: [2×2 double] samp_err: 0.1870 samp_dv: {[700×1 double] [300×1 double]} samp_opt_bd: [1×1 struct] samp_opt_dv: {[700×1 double] [300×1 double]} samp_opt_bd_pts: [-9.0121 1.3127] samp_opt_errmat: [2×2 double] samp_opt_err: 0.1820

Integrate normal in 2d

in a quadratic domain

defined by (x+y)^2 > x+1, i.e.
q(x,y)= [x y]*[1 1; 1 1]*[x;y] + [-1 0]*[x;y] -1 > 0
mu=[-1; -1]; v=[1 0.5; 0.5 2];
quad.q2=[1 1; 1 1];
quad.q1=[-1;0];
quad.q0=-1;
% compare two integration algorithms
[p,pc,bd_pts]=integrate_normal(mu,v,quad) % ray method
p = 0.8214
pc = 0.1786
bd_pts = 2×504
103 ×
-0.0001 0.0021 -0.0001 0.0021 -0.0001 0.0021 -0.0001 0.0021 -0.0001 0.0021 -0.0001 0.0021 -0.0001 0.0020 -0.0001 0.0020 -0.0001 0.0019 -0.0002 0.0019 -0.0002 0.0019 -0.0002 0.0018 -0.0002 0.0018 -0.0002 0.0018 -0.0002 0.0017 -0.0002 0.0017 -0.0002 0.0017 -0.0002 0.0017 -0.0002 0.0017 -0.0002 0.0016 -0.0002 0.0015 -0.0002 0.0015 -0.0002 0.0014 -0.0002 0.0013 -0.0003 0.0013 -0.0008 -0.0003 -0.0008 -0.0003 -0.0008 -0.0003 -0.0008 -0.0003 -0.0008 -0.0003 -0.0008 -0.0003 -0.0008 -0.0003 -0.0008 -0.0003 -0.0008 -0.0002 -0.0008 -0.0002 -0.0008 -0.0002 -0.0007 -0.0001 -0.0007 -0.0001 -0.0007 -0.0001 -0.0007 -0.0001 -0.0007 -0.0001 -0.0007 -0.0001 -0.0007 -0.0001 -0.0007 -0.0000 -0.0007 0.0000 -0.0007 0.0000 -0.0007 0.0001 -0.0006 0.0001 -0.0006 0.0002 -0.0006 0.0002
axis([-6 10 -10 2])
[p,pc]=integrate_normal(mu,v,quad,'method','gx2') % gx2 method
Warning: Reached the limit on the maximum number of intervals in use. Approximate bound on error is 1.2e-03. The integral may not exist, or it may be difficult to approximate numerically to the requested accuracy.
Warning: Reached the limit on the maximum number of intervals in use. Approximate bound on error is 1.2e-03. The integral may not exist, or it may be difficult to approximate numerically to the requested accuracy.
p = 0.8223
pc = 0.1777
axis([-6 10 -10 2])

[paper fig. 2c] In a non-quadratic domain

defined by f(x,y) = x sin y - y cos x -1 > 0:
fun=@(x,y) x.*sin(y) - y.*cos(x) -1;
integrate_normal(mu,v,fun,'dom_type','fun','fun_span',3);
axis([-5 5 -5 5])

pdf of f(x,y)

x=linspace(-10,10,100);
plot(x,norm_fun_pdf(x,mu,v,fun,'dx',1e-1))

[paper sec. 2.2.5] probabilities of a function x^y of a 2d normal

mu=[1;2]; v=.01*[1 1.6; 1.6 4];
fun=@(x,y) x.^y;

cdf

dx=.01; x=0:dx:3;
F=norm_fun_cdf(x,mu,v,fun,'fun_span',5,'fun_resol',500);
plot(x,F); xlabel x^y; ylabel 'cdf'

pdf

f=norm_fun_pdf(x,mu,v,fun,'fun_span',5,'fun_resol',500,'dx',1e-2);
plot(x,f); xlabel x^y; ylabel 'pdf'
Verify that pdf sums to 1:
sum(f)*dx
ans = 1.0000

Mean of x^y

m=sum(x.*f)*dx
m = 1.0266

sd of x^y

m2=sum(x.^2.*f)*dx;
sd=sqrt(m2-m^2)
sd = 0.2115

median of x^y

norm_fun_inv(.5,mu,v,fun)
ans = 1.0000

Joint probability of functions of a normal

% (x,y) is a normal vector with these parameters:
mu=[6;-19];
v=[1 -.7; -.7 2];
% functions of the normal vector
fun1=@(x,y) cos(4*x);
fun2=@(x,y) cos(4*y);
% p(cos 4x > 0)
integrate_normal(mu,v,fun1,'dom_type','fun','fun_span',3);
axis image; axis([2 10 -27 -11])
% p(cos 4y > 0)
integrate_normal(mu,v,fun2,'dom_type','fun','fun_span',3);
axis image; axis([2 10 -27 -11])
Probability that cos(4x) and cos(4y) are both > 0, i.e. integrate the normal in the domain \min (\cos 4x, \cos 4y)>0:
fun3=@(x,y) min(fun1(x,y),fun2(x,y));
p=integrate_normal(mu,v,fun3,'dom_type','fun','fun_span',3)
p = 0.2495
axis image; axis([2 10 -27 -11])
Probability that cos(4x) + cos(4y) > 0.5, i.e. integrate the normal in the domain cos(4x) + cos(4y) + 0.5 > 0
fun4=@(x,y) fun1(x,y)+fun2(x,y)-0.5;
p=integrate_normal(mu,v,fun4,'dom_type','fun','fun_span',3)
p = 0.3072
axis image; axis([2 10 -27 -11]);
Percentage points (inverse cdf):
p=[0.5 0.75];
x=norm_fun_inv(p,mu,v,fun4)
x = 1×2
-0.4999 0.2210

Classify two 2d normals, one inside the other

mu_1=[4; 5]; v_1=[2 1; 1 1];
mu_2=mu_1; v_2=3*[2 -1; -1 1];
% compare two integration algorithms
results_ray=classify_normals([mu_1,v_1],[mu_2,v_2]) % ray method
results_ray = struct with fields:
norm_bd: [1×1 struct] norm_bd_pts: [2×414 double] norm_errmat: [2×2 double] norm_err: 0.1979 norm_dprime: 1.6982 norm_maha_dprime: 0
axis([-2 8 0 10])
results_gx2=classify_normals([mu_1,v_1],[mu_2,v_2],'method','gx2') % gx2 method
Warning: Reached the limit on the maximum number of intervals in use. Approximate bound on error is 1.7e-06. The integral may not exist, or it may be difficult to approximate numerically to the requested accuracy.
Warning: Reached the limit on the maximum number of intervals in use. Approximate bound on error is 1.7e-06. The integral may not exist, or it may be difficult to approximate numerically to the requested accuracy.
results_gx2 = struct with fields:
norm_bd: [1×1 struct] norm_errmat: [2×2 double] norm_err: 0.1979 norm_dprime: 1.6982 norm_maha_dprime: 0
axis([-2 8 0 10])

[paper fig. 2d] Classify in 2d with custom boundaries and from samples

mu_1=[2;4]; v_1=[1 1.5; 1.5 3];
mu_2=[5;0]; v_2=[3 0; 0 1];
% ray method
results_ray=classify_normals([mu_1,v_1],[mu_2,v_2]);
axis image; axis([-10 10 -10 10])
results_ray.norm_err
ans = 0.0079
% compare with generalized chi square method
results_gx2=classify_normals([mu_1,v_1],[mu_2,v_2],'method','gx2');
axis image; axis([-10 10 -10 10])
results_gx2.norm_err
ans = 0.0079
% now supply a custom linear boundary
linear_bd.q2=zeros(2);
linear_bd.q1=[-.7;1];
linear_bd.q0=0;
results_linear=classify_normals([mu_1,v_1],[mu_2,v_2],'dom',linear_bd)
results_linear = struct with fields:
norm_bd_pts: [2×300 double] norm_errmat: [2×2 double] norm_err: 0.0133
axis image; axis([-10 10 -10 10])
% now classify using samples
n_samp=1e3;
samp_1=mvnrnd(mu_1,v_1,n_samp);
samp_2=mvnrnd(mu_2,v_2,n_samp);
results_samp=classify_normals(samp_1,samp_2,'input_type','samp')
Iteration Func-count min f(x) Procedure 0 1 -1987 1 7 -1987 initial simplex 2 8 -1987 reflect 3 16 -1987 shrink 4 18 -1987 contract outside 5 26 -1987 shrink 6 34 -1987 shrink 7 42 -1987 shrink 8 50 -1987 shrink 9 58 -1987 shrink 10 66 -1987 shrink 11 74 -1987 shrink 12 82 -1987 shrink 13 90 -1987 shrink 14 98 -1987 shrink 15 106 -1987 shrink 16 114 -1987 shrink 17 122 -1987 shrink 18 130 -1987 shrink 19 138 -1987 shrink 20 146 -1987 shrink 21 154 -1987 shrink 22 162 -1987 shrink 23 170 -1987 shrink 24 178 -1987 shrink 25 186 -1987 shrink 26 194 -1987 shrink 27 202 -1987 shrink 28 210 -1987 shrink 29 218 -1987 shrink 30 226 -1987 shrink 31 234 -1987 shrink 32 242 -1987 shrink 33 250 -1987 shrink 34 258 -1987 shrink 35 266 -1987 shrink 36 274 -1987 shrink 37 282 -1987 shrink 38 290 -1987 shrink 39 298 -1987 shrink 40 306 -1987 shrink 41 314 -1987 shrink 42 322 -1987 shrink 43 330 -1987 shrink 44 338 -1987 shrink 45 346 -1987 shrink 46 354 -1987 shrink 47 362 -1987 shrink 48 370 -1987 shrink Optimization terminated: the current x satisfies the termination criteria using OPTIONS.TolX of 0.000000e+00 and F(X) satisfies the convergence criteria using OPTIONS.TolFun of 5.000000e-04
results_samp = struct with fields:
norm_bd: [1×1 struct] norm_bd_pts: [2×516 double] norm_errmat: [2×2 double] norm_err: 0.0085 norm_dprime: 4.7736 norm_maha_dprime: 4.3714 samp_errmat: [2×2 double] samp_err: 0.0065 samp_dprime: 4.9675 samp_dv: {[1000×1 double] [1000×1 double]} samp_opt_bd: [1×1 struct] samp_opt_dv: {[1000×1 double] [1000×1 double]} samp_opt_bd_pts: [2×32450 double] samp_opt_errmat: [2×2 double] samp_opt_err: 0.0065 samp_opt_dprime: 4.9675
axis image; axis([-10 10 -10 10])
% modify the sample-optimized boundary and classify with it
custom_bd=results_samp.samp_opt_bd;
custom_bd.q2=custom_bd.q2+.1;
custom_bd.q1=custom_bd.q1-2.5;
custom_bd.q0=custom_bd.q0+5;
results_samp_custom=classify_normals(samp_1,samp_2,'input_type','samp','dom',custom_bd)
Iteration Func-count min f(x) Procedure 0 1 -1942 1 7 -1964 initial simplex 2 8 -1964 reflect 3 10 -1976 expand 4 11 -1976 reflect 5 12 -1976 reflect 6 14 -1981 expand 7 15 -1981 reflect 8 16 -1981 reflect 9 17 -1981 reflect 10 19 -1983 reflect 11 20 -1983 reflect 12 21 -1983 reflect 13 22 -1983 reflect 14 24 -1983 contract inside 15 26 -1983 contract inside 16 28 -1983 contract inside 17 30 -1983 contract inside 18 31 -1983 reflect 19 39 -1983 shrink 20 41 -1983 contract outside 21 49 -1983 shrink 22 50 -1983 reflect 23 51 -1983 reflect 24 52 -1983 reflect 25 54 -1983 contract inside 26 56 -1983 contract inside 27 64 -1983 shrink 28 72 -1983 shrink 29 80 -1983 shrink 30 88 -1983 shrink 31 96 -1983 shrink 32 104 -1983 shrink 33 112 -1983 shrink 34 120 -1983 shrink 35 128 -1983 shrink 36 136 -1983 shrink 37 144 -1983 shrink 38 152 -1983 shrink 39 160 -1983 shrink 40 168 -1983 shrink 41 176 -1983 shrink 42 184 -1983 shrink 43 192 -1983 shrink 44 200 -1983 shrink 45 208 -1983 shrink 46 216 -1983 shrink 47 224 -1983 shrink 48 232 -1983 shrink 49 240 -1983 shrink 50 248 -1983 shrink 51 256 -1983 shrink 52 264 -1983 shrink 53 272 -1983 shrink 54 280 -1983 shrink 55 288 -1983 shrink 56 296 -1983 shrink 57 304 -1983 shrink 58 312 -1983 shrink 59 320 -1983 shrink 60 328 -1983 shrink 61 336 -1983 shrink 62 344 -1983 shrink 63 352 -1983 shrink 64 360 -1983 shrink 65 368 -1983 shrink 66 376 -1983 shrink 67 384 -1983 shrink 68 392 -1983 shrink Optimization terminated: the current x satisfies the termination criteria using OPTIONS.TolX of 0.000000e+00 and F(X) satisfies the convergence criteria using OPTIONS.TolFun of 5.000000e-04
results_samp_custom = struct with fields:
norm_bd_pts: [2×438 double] norm_errmat: [2×2 double] norm_err: 0.0275 samp_errmat: [2×2 double] samp_err: 0.0290 samp_dv: {[1000×1 double] [1000×1 double]} samp_opt_bd: [1×1 struct] samp_opt_dv: {[1000×1 double] [1000×1 double]} samp_opt_bd_pts: [2×26558 double] samp_opt_errmat: [2×2 double] samp_opt_err: 0.0085
axis image; axis([-10 10 -10 10])

[paper fig. 2e] Classify in 2d with non-normal samples

n_samp=1e3;
samp_1=exp(mvnrnd([0 0],eye(2),n_samp));
samp_2=-exp(mvnrnd([1 1],eye(2),n_samp))+[2 2];
results=classify_normals(samp_1,samp_2,'input_type','samp')
Iteration Func-count min f(x) Procedure 0 1 -1485 1 7 -1490 initial simplex 2 9 -1507 expand 3 10 -1507 reflect 4 11 -1507 reflect 5 12 -1507 reflect 6 13 -1507 reflect 7 15 -1522 expand 8 16 -1522 reflect 9 18 -1540 expand 10 19 -1540 reflect 11 21 -1563 expand 12 22 -1563 reflect 13 24 -1594 expand 14 25 -1594 reflect 15 26 -1594 reflect 16 28 -1642 expand 17 29 -1642 reflect 18 31 -1719 expand 19 32 -1719 reflect 20 34 -1724 reflect 21 35 -1724 reflect 22 37 -1724 contract inside 23 38 -1724 reflect 24 40 -1724 contract inside 25 42 -1724 contract inside 26 43 -1724 reflect 27 45 -1724 contract inside 28 47 -1724 contract inside 29 49 -1724 contract inside 30 51 -1724 contract inside 31 53 -1724 contract inside 32 55 -1724 contract inside 33 56 -1724 reflect 34 58 -1724 contract inside 35 60 -1726 contract inside 36 62 -1726 contract inside 37 64 -1726 contract outside 38 65 -1726 reflect 39 67 -1726 contract outside 40 69 -1726 contract inside 41 77 -1727 shrink 42 78 -1727 reflect 43 80 -1727 contract inside 44 88 -1728 shrink 45 89 -1728 reflect 46 90 -1728 reflect 47 92 -1728 contract inside 48 93 -1728 reflect 49 95 -1729 reflect 50 96 -1729 reflect 51 97 -1729 reflect 52 105 -1729 shrink 53 107 -1729 contract outside 54 109 -1729 contract outside 55 117 -1729 shrink 56 118 -1729 reflect 57 119 -1729 reflect 58 121 -1729 contract outside 59 129 -1729 shrink 60 137 -1729 shrink 61 145 -1729 shrink 62 153 -1729 shrink 63 161 -1729 shrink 64 169 -1729 shrink 65 177 -1729 shrink 66 185 -1729 shrink 67 193 -1729 shrink 68 201 -1729 shrink 69 209 -1729 shrink 70 217 -1729 shrink 71 225 -1729 shrink 72 233 -1729 shrink 73 241 -1729 shrink 74 249 -1729 shrink 75 257 -1729 shrink 76 265 -1729 shrink 77 273 -1729 shrink 78 281 -1729 shrink 79 289 -1729 shrink 80 297 -1729 shrink 81 305 -1729 shrink 82 313 -1729 shrink 83 321 -1729 shrink 84 329 -1729 shrink 85 337 -1729 shrink 86 345 -1729 shrink 87 353 -1729 shrink 88 361 -1729 shrink 89 369 -1729 shrink 90 377 -1729 shrink 91 385 -1729 shrink 92 393 -1729 shrink 93 401 -1729 shrink 94 409 -1729 shrink 95 417 -1729 shrink 96 425 -1729 shrink 97 433 -1729 shrink 98 441 -1729 shrink Optimization terminated: the current x satisfies the termination criteria using OPTIONS.TolX of 0.000000e+00 and F(X) satisfies the convergence criteria using OPTIONS.TolFun of 5.000000e-04
results = struct with fields:
norm_bd: [1×1 struct] norm_bd_pts: [2×514 double] norm_errmat: [2×2 double] norm_err: 0.1425 norm_dprime: 2.1384 norm_maha_dprime: 1.3361 samp_errmat: [2×2 double] samp_err: 0.2575 samp_dprime: 1.3021 samp_dv: {[1000×1 double] [1000×1 double]} samp_opt_bd: [1×1 struct] samp_opt_dv: {[1000×1 double] [1000×1 double]} samp_opt_bd_pts: [2×27770 double] samp_opt_errmat: [2×2 double] samp_opt_err: 0.1355 samp_opt_dprime: 2.2015
axis image; axis([-20 15 -20 15])

Inversion/union/intersection of integration/classification domains

mu=[0;0]; v=[.5 0; 0 1];
circle_left=@(x,y) -(x+1).^2-y.^2+5;
circle_right=@(x,y) -(x-1).^2-y.^2+5;
circle_union=@(x,y) max(circle_left(x,y), circle_right(x,y));
p=integrate_normal(mu,v,circle_union,'dom_type','fun','fun_span',5)
p = 0.9680
axis image; axis([-4 4 -4 4])
circle_intersection=@(x,y) min(circle_left(x,y), circle_right(x,y));
p=integrate_normal(mu,v,circle_intersection,'dom_type','fun','fun_span',5)
p = 0.7949
axis image; axis([-4 4 -4 4])
crescent=@(x,y) max(circle_left(x,y), -circle_right(x,y));
p=integrate_normal(mu,v,crescent,'dom_type','fun','fun_span',5)
p = 0.9136
axis image; axis([-4 4 -4 4])
% classify normals using this crescent domain
mu_2=[2.2;0]; v_2=[.5 0; 0 .25];
results=classify_normals([mu,v],[mu_2,v_2],'dom',crescent,'dom_type','fun')
results = struct with fields:
norm_bd_pts: [2×586 double] norm_errmat: [2×2 double] norm_err: 0.1235
axis image; axis([-2 4 -3 3])

Classify in 3d

mu_1=[0;0;0]; v_1=eye(3);
mu_2=[2;1;1]; v_2=2*eye(3);
results=classify_normals([mu_1,v_1],[mu_2,v_2])
results = struct with fields:
norm_bd: [1×1 struct] norm_bd_pts: [3×11936 double] norm_errmat: [2×2 double] norm_err: 0.1390 norm_dprime: 2.1694 norm_maha_dprime: 2

Estimate tiny errors (large d') with high accuracy

format long
dprime_true=75
dprime_true =
75
mu_1=[0;0;0]; v=eye(3);
mu_2=dprime_true*[1;0;0];
results=classify_normals([mu_1,v],[mu_2,v],'AbsTol',0,'RelTol',1e-2)
results = struct with fields:
norm_bd: [1×1 struct] norm_bd_pts: [3×14112 double] norm_errmat: [2×2 double] norm_err: 4.608155172364448e-308 norm_dprime: 74.999967581801229 norm_maha_dprime: 75
axis image; axis([-5 80 -2 2 -2 2]); view(-53,25)
dprime_computed=results.norm_dprime
dprime_computed =
74.999967581801229
format

[paper fig. 4a] accuracy vs separation between the normals

mu_1=[0;0;0];
% both normals have the same covariance, so we can check against
% the true d' (Mahalanobis distance).
v=[1 .5 .7;
.5 2 1 ;
.7 1 3];
steps=linspace(1,100,10);
d_true=nan(size(steps));
d_gx2=nan(size(steps));
d_ray=nan(size(steps));
parfor i=1:length(steps)
i
mu_2=steps(i)*[1;1;1];
results_gx2=classify_normals([mu_1,v],[mu_2,v],'method','gx2','AbsTol',0,'RelTol',0,'plotmode',false);
d_true(i)=results_gx2.norm_maha_dprime;
d_gx2(i)=results_gx2.norm_dprime;
results_ray=classify_normals([mu_1,v],[mu_2,v],'method','ray','AbsTol',0,'RelTol',0,'plotmode',false);
d_ray(i)=results_ray.norm_dprime;
end
Starting parallel pool (parpool) using the 'local' profile ... Connected to the parallel pool (number of workers: 4). ans = 1 ans = 2 ans = 3 ans = 4 Warning: Integrand function outputs did not match to the required tolerance when the same input values were supplied in two separate calls with different size input matrices. Check that the function is vectorized properly. > In integral2Calc>integral2t/tensor (line 247) In integral2Calc>integral2t (line 55) In integral2Calc (line 9) In integral2 (line 106) In int_norm_ray (line 45) In integrate_normal (line 88) In classify_normals (line 194) In parallel_function>make_general_channel/channel_general (line 832) In remoteParallelFunction (line 67) Warning: Integrand function outputs did not match to the required tolerance when the same input values were supplied in two separate calls with different size input matrices. Check that the function is vectorized properly. > In integral2Calc>integral2t/tensor (line 247) In integral2Calc>integral2t (line 55) In integral2Calc (line 9) In integral2 (line 106) In int_norm_ray (line 44) In integrate_normal (line 88) In classify_normals (line 196) In parallel_function>make_general_channel/channel_general (line 832) In remoteParallelFunction (line 67) ans = 10 ans = 9 ans = 8 ans = 7 ans = 6 ans = 5 Warning: Integrand function outputs did not match to the required tolerance when the same input values were supplied in two separate calls with different size input matrices. Check that the function is vectorized properly. > In integral2Calc>integral2t/tensor (line 247) In integral2Calc>integral2t (line 55) In integral2Calc (line 9) In integral2 (line 106) In int_norm_ray (line 45) In integrate_normal (line 88) In classify_normals (line 194) In parallel_function>make_general_channel/channel_general (line 832) In remoteParallelFunction (line 67) Warning: Integrand function outputs did not match to the required tolerance when the same input values were supplied in two separate calls with different size input matrices. Check that the function is vectorized properly. > In integral2Calc>integral2t/tensor (line 247) In integral2Calc>integral2t (line 55) In integral2Calc (line 9) In integral2 (line 106) In int_norm_ray (line 44) In integrate_normal (line 88) In classify_normals (line 196) In parallel_function>make_general_channel/channel_general (line 832) In remoteParallelFunction (line 67)
rel_err_gx2=abs(d_gx2-d_true)./d_true;
rel_err_ray=abs(d_ray-d_true)./d_true;
figure; hold on
plot(d_true,rel_err_gx2,'-o')
plot(d_true,rel_err_ray,'-o')
xline(-2*norminv(realmin)) % largest computable d', corr. to the smallest possible error representable in double-precision
yline(eps) % machine epsilon for double precision
xlim([1 80]); ylim([0 2.2e-15])
xlabel 'true d'''
ylabel('$\epsilon$','interpreter','latex')
legend({'$\tilde{\chi}^2$','ray'},'interpreter','latex')

[paper fig. 2a] Integrate normal in a torus defined by function f(x)>0

mu=[0;0;0];
v=[1 0 0;
0 8 4;
0 4 8];
% plot the error ellipsoid of the normal
figure; plot_normal(mu,v);
fun_torus=@(x1,x2,x3) 1.5-(5-(x1.^2+x2.^2).^0.5).^2-x3.^2;
integrate_normal(mu,v,fun_torus,'dom_type','fun','fun_span',3,'fun_resol',10,'RelTol',1e-1);
axis image; axis([-7 7 -7 7 -7 7])

Plot the pdf and cdf of f(x)

x=[linspace(-80,-20,30) linspace(-20,10,20)];
f=norm_fun_pdf(x,mu,v,fun_torus,'fun_span',3,'fun_resol',10,'RelTol',1e-1,'dx',8);
plot(x,f)
p=norm_fun_cdf(x,mu,v,fun_torus,'fun_span',3,'fun_resol',10,'RelTol',1e-1);
plot(x,p)

[paper fig. 2g, top] Integrate normal in 4d

outside the sphere of radius 5, i.e. x1^2+x2^2+x3^2+x4^2>5^2, i.e. x'*eye(4)*x + zeros(4,1)'*x -25 >0
mu=[1;1;1;1]; v=diag([1 2 3 4]);
quad.q2=eye(4);
quad.q1=zeros(4,1);
quad.q0=-25;
p=integrate_normal(mu,v,quad)
p = 0.1276
axis([-30 40 0 .06]);

[paper fig. 2g, bottom] Classify in 4d, with priors and outcome values

mu_1=[0;0;0;0]; v_1=eye(4);
mu_2=[1;1;1;1]; v_2=eye(4);
% here the Bayes decision variable is normally distributed
results=classify_normals([mu_1,v_1],[mu_2,v_2],'prior_1',.7,'vals',[2 0; 0 1])
results = struct with fields:
norm_bd: [1×1 struct] norm_errmat: [2×2 double] norm_err: 0.1496 norm_valmat: [2×2 double] norm_val: 1.5236
mu_1=[0;0;0;0];
v_1=[1 0 0 0;
0 2 -1 0;
0 -1 3 2;
0 0 2 4];
mu_2=1.5*[1;1;1;1];
v_2=[2 0 0 0;
0 2 0 0;
0 0 2 0;
0 0 0 1];
% correct classification of class 1 is valued 4x than class 2
% here the Bayes decision variable is distributed as a generalized chi-square
results=classify_normals([mu_1,v_1],[mu_2,v_2],'prior_1',.7,'vals',[4 0; 0 1])
results = struct with fields:
norm_bd: [1×1 struct] norm_errmat: [2×2 double] norm_err: 0.1302 norm_valmat: [2×2 double] norm_val: 2.9431
% use ray method (with Monte Carlo integration)
results=classify_normals([mu_1,v_1],[mu_2,v_2],'prior_1',.7,'vals',[4 0; 0 1],'method','ray','mc_samples',1e3)
results = struct with fields:
norm_bd: [1×1 struct] norm_bd_pts: [4×2436 double] norm_errmat: [2×2 double] norm_err: 0.1289 norm_valmat: [2×2 double] norm_val: 2.9459
% now classify using samples
n_samp=1e3;
results=classify_normals(mvnrnd(mu_1',v_1,n_samp),mvnrnd(mu_2',v_2,n_samp),'input_type','samp','prior_1',.7,'vals',[4 0; 0 1])
Iteration Func-count min f(x) Procedure 0 1 -4506 1 16 -4512 initial simplex 2 18 -4537 expand 3 19 -4537 reflect 4 20 -4537 reflect 5 21 -4537 reflect 6 23 -4537 contract outside 7 24 -4537 reflect 8 25 -4537 reflect 9 26 -4537 reflect 10 27 -4537 reflect 11 28 -4537 reflect 12 29 -4537 reflect 13 30 -4537 reflect 14 31 -4537 reflect 15 32 -4537 reflect 16 33 -4537 reflect 17 34 -4537 reflect 18 35 -4537 reflect 19 36 -4537 reflect 20 37 -4537 reflect 21 38 -4537 reflect 22 39 -4537 reflect 23 40 -4537 reflect 24 41 -4537 reflect 25 42 -4537 reflect 26 44 -4550 expand 27 45 -4550 reflect 28 46 -4550 reflect 29 47 -4550 reflect 30 48 -4550 reflect 31 49 -4550 reflect 32 50 -4550 reflect 33 51 -4550 reflect 34 52 -4550 reflect 35 53 -4550 reflect 36 54 -4550 reflect 37 55 -4550 reflect 38 56 -4550 reflect 39 57 -4550 reflect 40 58 -4550 reflect 41 59 -4550 reflect 42 61 -4551 reflect 43 62 -4551 reflect 44 79 -4553 shrink 45 80 -4553 reflect 46 81 -4553 reflect 47 82 -4553 reflect 48 84 -4553 contract outside 49 85 -4553 reflect 50 86 -4553 reflect 51 87 -4553 reflect 52 88 -4553 reflect 53 90 -4553 contract inside 54 92 -4553 contract inside 55 93 -4553 reflect 56 110 -4553 shrink 57 112 -4553 contract outside 58 113 -4553 reflect 59 114 -4553 reflect 60 115 -4553 reflect 61 116 -4553 reflect 62 117 -4553 reflect 63 118 -4553 reflect 64 119 -4553 reflect 65 120 -4553 reflect 66 121 -4553 reflect 67 123 -4554 reflect 68 125 -4554 contract inside 69 126 -4554 reflect 70 143 -4554 shrink 71 144 -4554 reflect 72 145 -4554 reflect 73 146 -4554 reflect 74 148 -4554 contract outside 75 150 -4554 contract outside 76 152 -4554 contract inside 77 153 -4554 reflect 78 154 -4554 reflect 79 155 -4554 reflect 80 156 -4554 reflect 81 173 -4554 shrink 82 190 -4554 shrink 83 207 -4554 shrink 84 224 -4554 shrink 85 225 -4554 reflect 86 226 -4554 reflect 87 227 -4554 reflect 88 228 -4554 reflect 89 229 -4554 reflect 90 230 -4554 reflect 91 232 -4554 contract outside 92 249 -4554 shrink 93 266 -4554 shrink 94 283 -4554 shrink 95 300 -4554 shrink 96 317 -4554 shrink 97 334 -4554 shrink 98 351 -4554 shrink 99 368 -4554 shrink 100 385 -4554 shrink 101 402 -4554 shrink 102 419 -4554 shrink 103 436 -4554 shrink 104 453 -4554 shrink 105 470 -4554 shrink 106 487 -4554 shrink 107 504 -4554 shrink 108 521 -4554 shrink 109 538 -4554 shrink 110 555 -4554 shrink 111 572 -4554 shrink 112 589 -4554 shrink 113 606 -4554 shrink 114 623 -4554 shrink 115 640 -4554 shrink 116 657 -4554 shrink 117 674 -4554 shrink 118 691 -4554 shrink 119 708 -4554 shrink 120 725 -4554 shrink 121 742 -4554 shrink 122 759 -4554 shrink 123 776 -4554 shrink 124 793 -4554 shrink 125 810 -4554 shrink 126 827 -4554 shrink 127 844 -4554 shrink 128 861 -4554 shrink 129 878 -4554 shrink Optimization terminated: the current x satisfies the termination criteria using OPTIONS.TolX of 0.000000e+00 and F(X) satisfies the convergence criteria using OPTIONS.TolFun of 5.000000e-04
results = struct with fields:
norm_bd: [1×1 struct] norm_errmat: [2×2 double] norm_err: 0.1328 norm_valmat: [2×2 double] norm_val: 2.9402 samp_errmat: [2×2 double] samp_err: 0.2170 samp_valmat: [2×2 double] samp_val: 4506 samp_dv: {[1000×1 double] [1000×1 double]} samp_opt_bd: [1×1 struct] samp_opt_dv: {[1000×1 double] [1000×1 double]} samp_opt_errmat: [2×2 double] samp_opt_err: 0.1570 samp_opt_valmat: [2×2 double] samp_opt_val: 4554

[paper fig. 2b] Integrate in a 4d polyhedron, using Monte Carlo

mu=zeros(4,1);
v=eye(4);
fun=@(x1,x2,x3,x4) abs(x1)+abs(x2)+abs(x3)+abs(x4);
% find p(f(x)<1)
mc_samples=round(10.^linspace(1,4,20)); % # of Monte Carlo samples
n_repeat=5;
plist=nan(length(mc_samples),n_repeat);
for k=1:n_repeat
for i=1:length(mc_samples)
[~,p]=integrate_normal(mu,v,fun,'dom_type','fun','fun_level',1,'fun_span',3,'fun_resol',10,'mc_samples',mc_samples(i),'plotmode',0);
plist(i,k)=p;
end
end
plot(mc_samples,plist,'-k','marker','.','markersize',10)
xlabel 'Monte Carlo sample size'; ylabel 'p'
set(gca,'xscale','log')
Compute cdf and pdf of the polyhedral function
x=linspace(-1,8,50);
p=norm_fun_cdf(x,mu,v,fun);
plot(x,p,'-o')
f=norm_fun_pdf(x,mu,v,fun,'dx',0.5,'mc_samples',5e3);
plot(x,f)

Classifying 3 1d normals

normals=struct;
normals(1).mu=-1; normals(1).v=1;
normals(2).mu=1; normals(2).v=2;
normals(3).mu=4; normals(3).v=.5;
% priors and outcome values
priors=[.4 .5 .1];
vals=[4 0 0; 0 1 -2; 0 0 1];
results=classify_normals_multi(normals,'priors',priors,'vals',vals)
Integrating normal 1 in domain 1 Integrating normal 1 in domain 2 Integrating normal 1 in domain 3 Integrating normal 2 in domain 1 Integrating normal 2 in domain 2 Integrating normal 2 in domain 3 Integrating normal 3 in domain 1 Integrating normal 3 in domain 2 Integrating normal 3 in domain 3
results = struct with fields:
norm_bd_pts: {3×1 cell} norm_errmat: [3×3 double] norm_err: 0.2834 norm_valmat: [3×3 double] norm_val: 1.8466

Classifying 4 2d normals

% define struct of all normals
normals=struct;
normals(1).mu=[1;0]; normals(1).v=2*eye(2);
normals(2).mu=[0;1]; normals(2).v=eye(2);
normals(3).mu=[-1;0]; normals(3).v=eye(2);
normals(4).mu=[0;-1]; normals(4).v=eye(2);
% plot the multi-class boundary of normal 3
plot_boundary(@(n,mu,v) opt_class_multi(n,normals,3,'mu',mu,'v',v),2,'mu',normals(3).mu,'dom_type','ray_scan')
title 'boundary of normal 3'
% classify
results=classify_normals_multi(normals); axis image
Integrating normal 1 in domain 1 Integrating normal 1 in domain 2 Integrating normal 1 in domain 3 Integrating normal 1 in domain 4 Integrating normal 2 in domain 1 Integrating normal 2 in domain 2 Integrating normal 2 in domain 3 Integrating normal 2 in domain 4 Integrating normal 3 in domain 1 Integrating normal 3 in domain 2 Integrating normal 3 in domain 3 Integrating normal 3 in domain 4 Integrating normal 4 in domain 1 Integrating normal 4 in domain 2 Integrating normal 4 in domain 3 Integrating normal 4 in domain 4
% now classify using samples from these normals, with outcome values
samples=struct;
for i=1:4
samples(i).sample=mvnrnd(normals(i).mu,normals(i).v,1e4);
end
vals=diag([1 2 3 4]);
results_samp=classify_normals_multi(samples,'input_type','samp','vals',vals)
Integrating normal 1 in domain 1 Integrating normal 1 in domain 2 Integrating normal 1 in domain 3 Integrating normal 1 in domain 4 Integrating normal 2 in domain 1 Integrating normal 2 in domain 2 Integrating normal 2 in domain 3 Integrating normal 2 in domain 4 Integrating normal 3 in domain 1 Integrating normal 3 in domain 2 Integrating normal 3 in domain 3 Integrating normal 3 in domain 4 Integrating normal 4 in domain 1 Integrating normal 4 in domain 2 Integrating normal 4 in domain 3 Integrating normal 4 in domain 4
results_samp = struct with fields:
norm_bd_pts: {4×1 cell} norm_errmat: [4×4 double] norm_err: 0.4602 norm_valmat: [4×4 double] norm_val: 1.5604 samp_errmat: [4×4 double] samp_err: 0.4597 samp_valmat: [4×4 double] samp_val: 62507
axis image
% now classify using samples from t distributions similar to these normals
samples=struct;
for i=1:4
samples(i).sample=mvtrnd(normals(i).v,3,1e4)+normals(i).mu';
end
results_samp=classify_normals_multi(samples,'input_type','samp')
Integrating normal 1 in domain 1 Integrating normal 1 in domain 2 Integrating normal 1 in domain 3 Integrating normal 1 in domain 4 Integrating normal 2 in domain 1 Integrating normal 2 in domain 2 Integrating normal 2 in domain 3 Integrating normal 2 in domain 4 Integrating normal 3 in domain 1 Integrating normal 3 in domain 2 Integrating normal 3 in domain 3 Integrating normal 3 in domain 4 Integrating normal 4 in domain 1 Integrating normal 4 in domain 2 Integrating normal 4 in domain 3 Integrating normal 4 in domain 4
results_samp = struct with fields:
norm_bd_pts: {4×1 cell} norm_errmat: [4×4 double] norm_err: 0.5760 samp_errmat: [4×4 double] samp_err: 0.4583
axis image; axis([-6 6 -6 6])

[paper fig. 2f] Classifying 7 2d normals

% define struct of all normals
normals=struct;
normals(1).mu=[2;0]; normals(1).v=[2 1; 1 2];
normals(2).mu=[0;1]; normals(2).v=[.5 0; 0 1];
normals(3).mu=[-1;0]; normals(3).v=[1 .3; .3 1];
normals(4).mu=[0;-1]; normals(4).v=[.5 -.5; -.5 1];
normals(5).mu=[-2;2]; normals(5).v=.5*[1 1; 1 5];
normals(6).mu=[2;-3]; normals(6).v=.3*eye(2);
normals(7).mu=[-2;-2.5]; normals(7).v=[1 0; 0 .1];
% classify
results=classify_normals_multi(normals)
Integrating normal 1 in domain 1 Integrating normal 1 in domain 2 Integrating normal 1 in domain 3 Integrating normal 1 in domain 4 Integrating normal 1 in domain 5 Integrating normal 1 in domain 6 Integrating normal 1 in domain 7 Integrating normal 2 in domain 1 Integrating normal 2 in domain 2 Integrating normal 2 in domain 3 Integrating normal 2 in domain 4 Integrating normal 2 in domain 5 Integrating normal 2 in domain 6 Integrating normal 2 in domain 7 Integrating normal 3 in domain 1 Integrating normal 3 in domain 2 Integrating normal 3 in domain 3 Integrating normal 3 in domain 4 Integrating normal 3 in domain 5 Integrating normal 3 in domain 6 Integrating normal 3 in domain 7 Integrating normal 4 in domain 1 Integrating normal 4 in domain 2 Integrating normal 4 in domain 3 Integrating normal 4 in domain 4 Integrating normal 4 in domain 5 Integrating normal 4 in domain 6 Integrating normal 4 in domain 7 Integrating normal 5 in domain 1 Integrating normal 5 in domain 2 Integrating normal 5 in domain 3 Integrating normal 5 in domain 4 Integrating normal 5 in domain 5 Integrating normal 5 in domain 6 Integrating normal 5 in domain 7 Integrating normal 6 in domain 1 Integrating normal 6 in domain 2 Integrating normal 6 in domain 3 Integrating normal 6 in domain 4 Integrating normal 6 in domain 5 Integrating normal 6 in domain 6 Integrating normal 6 in domain 7 Integrating normal 7 in domain 1 Integrating normal 7 in domain 2 Integrating normal 7 in domain 3 Integrating normal 7 in domain 4 Integrating normal 7 in domain 5 Integrating normal 7 in domain 6 Integrating normal 7 in domain 7
results = struct with fields:
norm_bd_pts: {7×1 cell} norm_errmat: [7×7 double] norm_err: 0.2319
axis image; axis([-10 10 -10 10]);

Classifying 4 3d normals

normals=struct;
normals(1).mu=[1;0;0]; normals(1).v=2*eye(3);
normals(2).mu=[0;1;0]; normals(2).v=eye(3);
normals(3).mu=[-1;0;0]; normals(3).v=eye(3);
normals(4).mu=[0;-1;0]; normals(4).v=eye(3);
results=classify_normals_multi(normals)
Integrating normal 1 in domain 1 Integrating normal 1 in domain 2 Integrating normal 1 in domain 3 Integrating normal 1 in domain 4 Integrating normal 2 in domain 1 Integrating normal 2 in domain 2 Integrating normal 2 in domain 3 Integrating normal 2 in domain 4 Integrating normal 3 in domain 1 Integrating normal 3 in domain 2 Integrating normal 3 in domain 3 Integrating normal 3 in domain 4 Integrating normal 4 in domain 1 Integrating normal 4 in domain 2 Integrating normal 4 in domain 3 Integrating normal 4 in domain 4
results = struct with fields:
norm_bd_pts: {4×1 cell} norm_errmat: [4×4 double] norm_err: 0.4254

[paper fig. 2h] Classifying 4 4d t distribution samples

params=struct;
params(1).mu=[0;-4;-2;-2]; params(1).v=diag([1 2 3 4]);
params(2).mu=[1;1;0;0]; params(2).v=eye(4)/4;
params(3).mu=[3;4;5;7]; params(3).v=eye(4);
params(4).mu=[5;5;7;4]; params(4).v=eye(4);
priors=[.3 .5 .15 .05];
n_samp=1e3;
samples=struct;
for i=1:4
samples(i).sample=mvtrnd(params(i).v,3,n_samp)+params(i).mu';
end
results_samp=classify_normals_multi(samples,'input_type','samp','priors',priors,'mc_samples',1e3,'plotmode',[1;1;1;1])
Integrating normal 1 in domain 1
Integrating normal 1 in domain 2
Integrating normal 1 in domain 3
Integrating normal 1 in domain 4
Integrating normal 2 in domain 1
Integrating normal 2 in domain 2
Integrating normal 2 in domain 3
Integrating normal 2 in domain 4
Integrating normal 3 in domain 1
Integrating normal 3 in domain 2
Integrating normal 3 in domain 3
Integrating normal 3 in domain 4
Integrating normal 4 in domain 1
Integrating normal 4 in domain 2
Integrating normal 4 in domain 3
Integrating normal 4 in domain 4
results_samp = struct with fields:
norm_bd_pts: {4×1 cell} norm_errmat: [4×4 double] norm_err: 0.0448 samp_errmat: [4×4 double] samp_err: 0.0675

[paper figs. 3a,b] testing the normal approximation for 2 2d classes

N_samp=1e4; n_samp=1e2;
mu_1=[5 5]; v_1=[1 .5; .5 1]; samp_1=mvnrnd(mu_1,v_1,N_samp).^3; % not normal
mu_2=[-200 -200]; v_2=[1 1; 1 3]*2e3; samp_2=mvnrnd(mu_2,v_2,N_samp);
results=classify_normals(samp_1,samp_2,'input_type','samp','samp_opt',false);
axis([-300 600 -400 600]); hold on
bd=results.norm_bd;
q0s=linspace(-100,35,100)';
true_p11=nan(size(q0s)); true_p2_2=nan(size(q0s)); % p(1|1)
norm_p11=nan(size(q0s)); norm_p2_2=nan(size(q0s));
for i=1:length(q0s)
bd_shift=bd; bd_shift.q0=q0s(i);
if ~rem(i,10)
plot_boundary(bd_shift,2,'plot_type','line','line_color',.5*[1 1 1]);
end
results_shift=classify_normals(samp_1,samp_2,'input_type','samp','dom',bd_shift,'samp_opt',false,'plotmode',false);
% true outcomes
true_p11(i)=results_shift.samp_errmat(1,1)/N_samp;
true_p2_2(i)=results_shift.samp_errmat(2,2)/N_samp;
% normal outcomes
norm_p11(i)=results_shift.norm_errmat(1,1)/.5;
norm_p2_2(i)=results_shift.norm_errmat(2,2)/.5;
end
true_p1_1_sd=sqrt(true_p11.*(1-true_p11)/n_samp);
true_p2_2_sd=sqrt(true_p2_2.*(1-true_p2_2)/n_samp);
norm_p1_1_sd=sqrt(norm_p11.*(1-norm_p11)/n_samp);
norm_p2_2_sd=sqrt(norm_p2_2.*(1-norm_p2_2)/n_samp);
figure; hold on
colors=colororder;
xline(bd.q0,'k','optimal boundary','LabelVerticalAlignment','bottom') % optimal criterion
% p(1|1)
x=q0s; y=true_p11; dy=true_p1_1_sd;
fill([x;flipud(x)],[y-dy;flipud(y+dy)],colors(1,:),'facealpha',.3,'linestyle','none');
y=norm_p11; dy=norm_p1_1_sd;
fill([x;flipud(x)],[y-dy;flipud(y+dy)],'k','facecolor','none','edgecolor',colors(1,:));
% p(2|2)
y=true_p2_2; dy=true_p2_2_sd;
fill([x;flipud(x)],[y-dy;flipud(y+dy)],colors(2,:),'facealpha',.3,'linestyle','none');
y=norm_p2_2; dy=norm_p2_2_sd;
fill([x;flipud(x)],[y-dy;flipud(y+dy)],'k','facecolor','none','edgecolor',colors(2,:));
xlim([min(q0s) max(q0s)]); ylim([-.01 1.01]); xlabel('boundary offset q_0')

[paper figs. 3c,d] testing the normal approximation for 4 4d t distributions

n_class=4; N_samp=1e4; n_samp=1e2;
% t distribution parameters
params_t=struct;
params_t(1).mu=[0;-4;-2;-2]; params_t(1).v=diag([1 2 3 4]);
params_t(2).mu=[1;1;0;0]; params_t(2).v=eye(4)/4;
params_t(3).mu=[3;4;5;7]; params_t(3).v=eye(4);
params_t(4).mu=[5;5;7;4]; params_t(4).v=eye(4);
samples=struct; params_samp=struct;
for i=1:4
% generate t samples
sample=mvtrnd(params_t(i).v,3,N_samp)+params_t(i).mu';
samples(i).sample=sample;
% mean and covariance of samples
params_samp(i).mu=mean(sample)';
params_samp(i).v=cov(sample)';
end
len_fam=10;
prior_fam=10.^linspace(-6,12,len_fam)';
vscale_fam=10.^linspace(-1,3,len_fam)';
true_p22_mean=nan(len_fam,1);
true_pe_mean=nan(len_fam,1);
true_pe_sd=nan(len_fam,1);
norm_p22_mean=nan(len_fam,1);
norm_pe_mean=nan(len_fam,1);
norm_pe_sd=nan(len_fam,1);
parfor i=1:len_fam
i
% generate family of classification domains
% uncomment when varying prior, comment when varying variance
priors_shift=[1 prior_fam(i) 1 1]; priors_shift=priors_shift/sum(priors_shift);
domains_shift=cell(n_class,1);
for k=1:n_class
domains_shift{k}=@(n,mu,v) opt_class_multi(n,params_samp,k,'mu',mu,'v',v,'priors',priors_shift);
end
% uncomment when varying variance, comment when varying prior
% params_samp_shift=params_samp;
% for k=1:n_class
% params_samp_shift(k).v=vscale_fam(i)*params_samp(k).v;
% end
% domains_shift=cell(n_class,1);
% for k=1:n_class
% domains_shift{k}=@(n,mu,v) opt_class_multi(n,params_samp_shift,k,'mu',mu,'v',v);
% end
results_shift=classify_normals_multi(samples,'input_type','samp','doms',domains_shift,'mc_samples',5e3,'plotmode',false);
% true error rates
true_p22_mean(i)=results_shift.samp_errmat(2,2)/N_samp;
true_pe_mean(i)=results_shift.samp_err;
samp_errmat_p=results_shift.samp_errmat/(n_class*N_samp);
errs=sum(~eye(length(samples)).*samp_errmat_p,2);
accs=diag(samp_errmat_p);
true_pe_sd(i)=sqrt(sum(errs.*accs)/n_samp);
% normal error rates
norm_p22_mean(i)=results_shift.norm_errmat(2,2)/sum(results_shift.norm_errmat(2,:));
norm_pe_mean(i)=results_shift.norm_err;
errs=sum(~eye(length(samples)).*results_shift.norm_errmat,2);
accs=diag(results_shift.norm_errmat);
norm_pe_sd(i)=sqrt(sum(errs.*accs)/n_samp);
end
ans = 1 ans = 2 ans = 3 ans = 4 Integrating normal 1 in domain 1 Integrating normal 1 in domain 1 Integrating normal 1 in domain 1 Integrating normal 1 in domain 1 Integrating normal 1 in domain 2 Integrating normal 1 in domain 2 Integrating normal 1 in domain 2 Integrating normal 1 in domain 2 Integrating normal 1 in domain 3 Integrating normal 1 in domain 3 Integrating normal 1 in domain 3 Integrating normal 1 in domain 3 Integrating normal 1 in domain 4 Integrating normal 1 in domain 4 Integrating normal 1 in domain 4 Integrating normal 1 in domain 4 Integrating normal 2 in domain 1 Integrating normal 2 in domain 1 Integrating normal 2 in domain 1 Integrating normal 2 in domain 1 Integrating normal 2 in domain 2 Integrating normal 2 in domain 2 Integrating normal 2 in domain 2 Integrating normal 2 in domain 2 Integrating normal 2 in domain 3 Integrating normal 2 in domain 3 Integrating normal 2 in domain 3 Integrating normal 2 in domain 3 Integrating normal 2 in domain 4 Integrating normal 2 in domain 4 Integrating normal 2 in domain 4 Integrating normal 2 in domain 4 Integrating normal 3 in domain 1 Integrating normal 3 in domain 1 Integrating normal 3 in domain 1 Integrating normal 3 in domain 1 Integrating normal 3 in domain 2 Integrating normal 3 in domain 2 Integrating normal 3 in domain 2 Integrating normal 3 in domain 2 Integrating normal 3 in domain 3 Integrating normal 3 in domain 3 Integrating normal 3 in domain 3 Integrating normal 3 in domain 3 Integrating normal 3 in domain 4 Integrating normal 3 in domain 4 Integrating normal 3 in domain 4 Integrating normal 3 in domain 4 Integrating normal 4 in domain 1 Integrating normal 4 in domain 1 Integrating normal 4 in domain 1 Integrating normal 4 in domain 1 Integrating normal 4 in domain 2 Integrating normal 4 in domain 2 Integrating normal 4 in domain 2 Integrating normal 4 in domain 2 Integrating normal 4 in domain 3 Integrating normal 4 in domain 3 Integrating normal 4 in domain 3 Integrating normal 4 in domain 3 Integrating normal 4 in domain 4 Integrating normal 4 in domain 4 Integrating normal 4 in domain 4 Integrating normal 4 in domain 4 ans = 5 Integrating normal 1 in domain 1 ans = 6 Integrating normal 1 in domain 1 ans = 8 Integrating normal 1 in domain 1 ans = 10 Integrating normal 1 in domain 1 Integrating normal 1 in domain 2 Integrating normal 1 in domain 2 Integrating normal 1 in domain 2 Integrating normal 1 in domain 2 Integrating normal 1 in domain 3 Integrating normal 1 in domain 3 Integrating normal 1 in domain 3 Integrating normal 1 in domain 3 Integrating normal 1 in domain 4 Integrating normal 1 in domain 4 Integrating normal 1 in domain 4 Integrating normal 1 in domain 4 Integrating normal 2 in domain 1 Integrating normal 2 in domain 1 Integrating normal 2 in domain 1 Integrating normal 2 in domain 1 Integrating normal 2 in domain 2 Integrating normal 2 in domain 2 Integrating normal 2 in domain 2 Integrating normal 2 in domain 2 Integrating normal 2 in domain 3 Integrating normal 2 in domain 3 Integrating normal 2 in domain 3 Integrating normal 2 in domain 3 Integrating normal 2 in domain 4 Integrating normal 2 in domain 4 Integrating normal 2 in domain 4 Integrating normal 2 in domain 4 Integrating normal 3 in domain 1 Integrating normal 3 in domain 1 Integrating normal 3 in domain 1 Integrating normal 3 in domain 1 Integrating normal 3 in domain 2 Integrating normal 3 in domain 2 Integrating normal 3 in domain 2 Integrating normal 3 in domain 2 Integrating normal 3 in domain 3 Integrating normal 3 in domain 3 Integrating normal 3 in domain 3 Integrating normal 3 in domain 3 Integrating normal 3 in domain 4 Integrating normal 3 in domain 4 Integrating normal 3 in domain 4 Integrating normal 3 in domain 4 Integrating normal 4 in domain 1 Integrating normal 4 in domain 1 Integrating normal 4 in domain 1 Integrating normal 4 in domain 1 Integrating normal 4 in domain 2 Integrating normal 4 in domain 2 Integrating normal 4 in domain 2 Integrating normal 4 in domain 2 Integrating normal 4 in domain 3 Integrating normal 4 in domain 3 Integrating normal 4 in domain 3 Integrating normal 4 in domain 3 Integrating normal 4 in domain 4 Integrating normal 4 in domain 4 Integrating normal 4 in domain 4 Integrating normal 4 in domain 4 ans = 7 Integrating normal 1 in domain 1 ans = 9 Integrating normal 1 in domain 1 Integrating normal 1 in domain 2 Integrating normal 1 in domain 2 Integrating normal 1 in domain 3 Integrating normal 1 in domain 3 Integrating normal 1 in domain 4 Integrating normal 1 in domain 4 Integrating normal 2 in domain 1 Integrating normal 2 in domain 1 Integrating normal 2 in domain 2 Integrating normal 2 in domain 2 Integrating normal 2 in domain 3 Integrating normal 2 in domain 3 Integrating normal 2 in domain 4 Integrating normal 2 in domain 4 Integrating normal 3 in domain 1 Integrating normal 3 in domain 1 Integrating normal 3 in domain 2 Integrating normal 3 in domain 2 Integrating normal 3 in domain 3 Integrating normal 3 in domain 3 Integrating normal 3 in domain 4 Integrating normal 3 in domain 4 Integrating normal 4 in domain 1 Integrating normal 4 in domain 1 Integrating normal 4 in domain 2 Integrating normal 4 in domain 2 Integrating normal 4 in domain 3 Integrating normal 4 in domain 3 Integrating normal 4 in domain 4 Integrating normal 4 in domain 4
true_p22_sd=sqrt(true_p22_mean.*(1-true_p22_mean)/n_samp);
norm_p22_sd=sqrt(norm_p22_mean.*(1-norm_p22_mean)/n_samp);
figure; hold on;
% uncomment when varying prior, comment when varying variance
xline(1/3,'k','optimal boundary','LabelVerticalAlignment','bottom')
xlabel('assumed prior ratio p_1/(p_2+p_3+p_4)')
x=prior_fam/3;
% uncomment when varying variance, comment when varying prior
% xline(1,'k','optimal boundary','LabelVerticalAlignment','bottom')
% xlabel('assumed variance scale')
% x=vscale_fam;
% p(2|2)
y=true_p22_mean; dy=true_p22_sd;
fill([x;flipud(x)],[y-dy;flipud(y+dy)],[0.9290 0.6940 0.1250],'facealpha',.3,'linestyle','none');
y=norm_p22_mean; dy=norm_p22_sd;
fill([x;flipud(x)],[y-dy;flipud(y+dy)],'k','facecolor','none','edgecolor',[0.9290 0.6940 0.1250]);
% pe
y=true_pe_mean; dy=true_pe_sd;
fill([x;flipud(x)],[y-dy;flipud(y+dy)],[0.6 0.4 0.2],'facealpha',.3,'linestyle','none');
y=norm_pe_mean; dy=norm_pe_sd;
fill([x;flipud(x)],[y-dy;flipud(y+dy)],'k','facecolor','none','edgecolor',[0.6 0.4 0.2]);
xlim([min(x) max(x)]); set(gca,'xscale','log'); ylim([-.01 1.01])

[paper fig. 5b] Actual vision research data: detecting targets on natural scenes

absent=importdata('target_absent.txt',',',1);
present=importdata('target_present.txt',',',1);
results=classify_normals(absent.data,present.data,'input_type','samp')
Iteration Func-count min f(x) Procedure 0 1 -4569 1 11 -4579 initial simplex 2 13 -4582 expand 3 14 -4582 reflect 4 15 -4582 reflect 5 16 -4582 reflect 6 17 -4582 reflect 7 19 -4583 reflect 8 20 -4583 reflect 9 21 -4583 reflect 10 23 -4585 reflect 11 24 -4585 reflect 12 25 -4585 reflect 13 27 -4586 reflect 14 28 -4586 reflect 15 29 -4586 reflect 16 41 -4586 shrink 17 42 -4586 reflect 18 44 -4586 contract inside 19 46 -4586 contract inside 20 48 -4586 contract inside 21 50 -4586 contract inside 22 52 -4586 contract inside 23 53 -4586 reflect 24 54 -4586 reflect 25 56 -4586 contract inside 26 68 -4587 shrink 27 70 -4587 contract inside 28 72 -4588 contract inside 29 73 -4588 reflect 30 74 -4588 reflect 31 86 -4588 shrink 32 98 -4588 shrink 33 99 -4588 reflect 34 100 -4588 reflect 35 101 -4588 reflect 36 102 -4588 reflect 37 114 -4588 shrink 38 116 -4588 contract outside 39 128 -4588 shrink 40 130 -4588 contract inside 41 142 -4588 shrink 42 154 -4588 shrink 43 166 -4588 shrink 44 178 -4588 shrink 45 190 -4588 shrink 46 202 -4588 shrink 47 214 -4588 shrink 48 226 -4588 shrink 49 238 -4588 shrink 50 250 -4588 shrink 51 262 -4588 shrink 52 274 -4588 shrink 53 286 -4588 shrink 54 298 -4588 shrink 55 310 -4588 shrink 56 322 -4588 shrink 57 334 -4588 shrink 58 346 -4588 shrink 59 358 -4588 shrink 60 370 -4588 shrink 61 382 -4588 shrink 62 394 -4588 shrink 63 406 -4588 shrink 64 418 -4588 shrink 65 430 -4588 shrink 66 442 -4588 shrink 67 454 -4588 shrink 68 466 -4588 shrink 69 478 -4588 shrink 70 490 -4588 shrink 71 502 -4588 shrink 72 514 -4588 shrink 73 526 -4588 shrink 74 538 -4588 shrink 75 550 -4588 shrink 76 562 -4588 shrink 77 574 -4588 shrink 78 586 -4588 shrink Optimization terminated: the current x satisfies the termination criteria using OPTIONS.TolX of 0.000000e+00 and F(X) satisfies the convergence criteria using OPTIONS.TolFun of 2.173913e-04
results = struct with fields:
norm_bd: [1×1 struct] norm_bd_pts: [3×3754 double] norm_errmat: [2×2 double] norm_err: 8.0400e-05 norm_dprime: 7.5475 norm_maha_dprime: 6.8175 samp_errmat: [2×2 double] samp_err: 0.0067 samp_dprime: 4.9418 samp_dv: {[2300×1 double] [2300×1 double]} samp_opt_bd: [1×1 struct] samp_opt_dv: {[2300×1 double] [2300×1 double]} samp_opt_bd_pts: [3×26070 double] samp_opt_errmat: [2×2 double] samp_opt_err: 0.0026 samp_opt_dprime: 5.5866
axis normal
axis([-50 170 -320 200 0 1000]); view(166,40)
xlabel('template'); ylabel('silhouette'); zlabel('edge');

[paper figs. 5d-h] Actual vision research data: detecting camouflage

load camouflage_edge_data
results_joint_2=classify_normals([edge_powers_2(:,1),edge_lpr_2(:,1)],[edge_powers_2(:,2),edge_lpr_2(:,2)],'input_type','samp');
Iteration Func-count min f(x) Procedure 0 1 -1.99656e+06 1 7 -1.99716e+06 initial simplex 2 8 -1.99716e+06 reflect 3 10 -1.99716e+06 contract inside 4 12 -1.99716e+06 contract inside 5 14 -1.99716e+06 contract outside 6 16 -1.99716e+06 contract outside 7 18 -1.99716e+06 contract inside 8 20 -1.99716e+06 contract inside 9 21 -1.99716e+06 reflect 10 23 -1.99719e+06 contract inside 11 25 -1.99756e+06 contract inside 12 27 -1.99756e+06 contract inside 13 29 -1.99758e+06 contract inside 14 31 -1.99763e+06 contract inside 15 33 -1.99774e+06 contract inside 16 34 -1.99774e+06 reflect 17 36 -1.99774e+06 contract inside 18 38 -1.99778e+06 contract inside 19 39 -1.99778e+06 reflect 20 40 -1.99778e+06 reflect 21 42 -1.99778e+06 contract inside 22 43 -1.99778e+06 reflect 23 45 -1.99784e+06 contract inside 24 47 -1.99784e+06 contract inside 25 48 -1.99784e+06 reflect 26 50 -1.99784e+06 contract inside 27 52 -1.99784e+06 contract inside 28 54 -1.99784e+06 contract inside 29 55 -1.99784e+06 reflect 30 56 -1.99784e+06 reflect 31 58 -1.99784e+06 contract inside 32 60 -1.99784e+06 contract inside 33 62 -1.99785e+06 reflect 34 64 -1.99785e+06 contract outside 35 65 -1.99785e+06 reflect 36 67 -1.99785e+06 contract inside 37 69 -1.99785e+06 contract outside 38 70 -1.99785e+06 reflect 39 72 -1.99785e+06 contract inside 40 74 -1.99785e+06 contract inside 41 76 -1.99785e+06 contract inside 42 77 -1.99785e+06 reflect 43 79 -1.99785e+06 contract inside 44 81 -1.99785e+06 reflect 45 82 -1.99785e+06 reflect 46 83 -1.99785e+06 reflect 47 84 -1.99785e+06 reflect 48 86 -1.99785e+06 contract inside 49 88 -1.99785e+06 contract outside 50 90 -1.99785e+06 reflect 51 98 -1.99785e+06 shrink 52 100 -1.99785e+06 contract outside 53 102 -1.99785e+06 contract outside 54 104 -1.99785e+06 contract inside 55 106 -1.99786e+06 contract inside 56 107 -1.99786e+06 reflect 57 115 -1.99786e+06 shrink 58 123 -1.99786e+06 shrink 59 125 -1.99786e+06 contract inside 60 127 -1.99786e+06 contract outside 61 128 -1.99786e+06 reflect 62 129 -1.99786e+06 reflect 63 137 -1.99786e+06 shrink 64 138 -1.99786e+06 reflect 65 140 -1.99786e+06 contract inside 66 142 -1.99786e+06 contract inside 67 150 -1.99786e+06 shrink 68 151 -1.99786e+06 reflect 69 152 -1.99786e+06 reflect 70 153 -1.99786e+06 reflect 71 155 -1.99786e+06 contract inside 72 163 -1.99786e+06 shrink 73 171 -1.99786e+06 shrink 74 179 -1.99786e+06 shrink 75 187 -1.99786e+06 shrink 76 195 -1.99786e+06 shrink 77 203 -1.99786e+06 shrink 78 211 -1.99786e+06 shrink 79 219 -1.99786e+06 shrink 80 227 -1.99786e+06 shrink 81 235 -1.99786e+06 shrink 82 243 -1.99786e+06 shrink 83 251 -1.99786e+06 shrink 84 259 -1.99786e+06 shrink 85 267 -1.99786e+06 shrink 86 275 -1.99786e+06 shrink 87 283 -1.99786e+06 shrink 88 291 -1.99786e+06 shrink 89 299 -1.99786e+06 shrink 90 307 -1.99786e+06 shrink 91 315 -1.99786e+06 shrink 92 323 -1.99786e+06 shrink 93 331 -1.99786e+06 shrink 94 339 -1.99786e+06 shrink 95 347 -1.99786e+06 shrink 96 355 -1.99786e+06 shrink 97 363 -1.99786e+06 shrink 98 371 -1.99786e+06 shrink 99 379 -1.99786e+06 shrink 100 387 -1.99786e+06 shrink 101 395 -1.99786e+06 shrink 102 403 -1.99786e+06 shrink 103 411 -1.99786e+06 shrink 104 419 -1.99786e+06 shrink 105 427 -1.99786e+06 shrink 106 435 -1.99786e+06 shrink Optimization terminated: the current x satisfies the termination criteria using OPTIONS.TolX of 0.000000e+00 and F(X) satisfies the convergence criteria using OPTIONS.TolFun of 5.000000e-07
axis([0.2 1 -900 400])
xlabel 'edge power'; ylabel 'edge spectrum'
results_dv_2=classify_normals(results_joint_2.samp_opt_dv{1},results_joint_2.samp_opt_dv{2},'input_type','samp','dom',@(x) x,'dom_type','fun','samp_opt',false);
axis([-50 100 0 .04])
xlabel('$q_s(${\boldmath$x$}$)$','interpreter','latex');
results_joint_4=classify_normals([edge_powers_4(:,1),edge_lpr_4(:,1)],[edge_powers_4(:,2),edge_lpr_4(:,2)],'input_type','samp','plotmode',false);
Iteration Func-count min f(x) Procedure 0 1 -1.9574e+06 1 7 -1.9574e+06 initial simplex 2 9 -1.9574e+06 contract inside 3 11 -1.9574e+06 contract outside 4 13 -1.9574e+06 contract outside 5 14 -1.9574e+06 reflect 6 16 -1.9574e+06 contract inside 7 18 -1.9574e+06 contract inside 8 20 -1.9574e+06 contract outside 9 22 -1.9574e+06 contract inside 10 24 -1.9574e+06 contract inside 11 26 -1.9574e+06 contract inside 12 28 -1.95741e+06 contract inside 13 30 -1.95782e+06 contract inside 14 32 -1.95782e+06 contract outside 15 34 -1.95783e+06 contract inside 16 36 -1.95808e+06 contract inside 17 37 -1.95808e+06 reflect 18 39 -1.95808e+06 contract inside 19 41 -1.95808e+06 contract inside 20 43 -1.95808e+06 contract inside 21 45 -1.95808e+06 contract inside 22 47 -1.95808e+06 contract inside 23 49 -1.95811e+06 contract inside 24 50 -1.95811e+06 reflect 25 52 -1.95811e+06 contract inside 26 54 -1.95811e+06 contract inside 27 56 -1.95814e+06 contract inside 28 58 -1.95818e+06 contract inside 29 60 -1.95819e+06 reflect 30 62 -1.95819e+06 contract inside 31 64 -1.95819e+06 contract inside 32 66 -1.95819e+06 contract inside 33 68 -1.95819e+06 contract inside 34 70 -1.9582e+06 contract inside 35 72 -1.9582e+06 contract inside 36 74 -1.9582e+06 contract inside 37 75 -1.9582e+06 reflect 38 77 -1.95822e+06 contract inside 39 78 -1.95822e+06 reflect 40 80 -1.95822e+06 contract inside 41 82 -1.95822e+06 contract inside 42 84 -1.95822e+06 contract inside 43 86 -1.95822e+06 contract inside 44 88 -1.95822e+06 contract inside 45 89 -1.95822e+06 reflect 46 90 -1.95822e+06 reflect 47 92 -1.95823e+06 expand 48 93 -1.95823e+06 reflect 49 95 -1.95823e+06 contract inside 50 96 -1.95823e+06 reflect 51 97 -1.95823e+06 reflect 52 99 -1.95824e+06 reflect 53 101 -1.95824e+06 contract inside 54 103 -1.95825e+06 expand 55 104 -1.95825e+06 reflect 56 106 -1.95825e+06 reflect 57 107 -1.95825e+06 reflect 58 115 -1.95825e+06 shrink 59 117 -1.95825e+06 contract inside 60 118 -1.95825e+06 reflect 61 120 -1.95825e+06 contract inside 62 122 -1.95826e+06 expand 63 123 -1.95826e+06 reflect 64 125 -1.95826e+06 contract inside 65 127 -1.95826e+06 contract inside 66 128 -1.95826e+06 reflect 67 130 -1.95827e+06 expand 68 132 -1.95827e+06 contract outside 69 133 -1.95827e+06 reflect 70 134 -1.95827e+06 reflect 71 135 -1.95827e+06 reflect 72 137 -1.95828e+06 expand 73 138 -1.95828e+06 reflect 74 140 -1.95828e+06 reflect 75 142 -1.95829e+06 expand 76 143 -1.95829e+06 reflect 77 145 -1.95829e+06 contract inside 78 147 -1.95834e+06 expand 79 148 -1.95834e+06 reflect 80 149 -1.95834e+06 reflect 81 150 -1.95834e+06 reflect 82 151 -1.95834e+06 reflect 83 153 -1.95838e+06 expand 84 154 -1.95838e+06 reflect 85 155 -1.95838e+06 reflect 86 156 -1.95838e+06 reflect 87 158 -1.9584e+06 expand 88 159 -1.9584e+06 reflect 89 161 -1.95846e+06 expand 90 162 -1.95846e+06 reflect 91 163 -1.95846e+06 reflect 92 164 -1.95846e+06 reflect 93 166 -1.9585e+06 expand 94 167 -1.9585e+06 reflect 95 169 -1.95856e+06 expand 96 170 -1.95856e+06 reflect 97 172 -1.95862e+06 expand 98 173 -1.95862e+06 reflect 99 174 -1.95862e+06 reflect 100 175 -1.95862e+06 reflect 101 177 -1.95865e+06 expand 102 178 -1.95865e+06 reflect 103 179 -1.95865e+06 reflect 104 180 -1.95865e+06 reflect 105 182 -1.95867e+06 expand 106 184 -1.95867e+06 contract outside 107 186 -1.95872e+06 expand 108 188 -1.95872e+06 contract inside 109 189 -1.95872e+06 reflect 110 191 -1.95872e+06 contract inside 111 192 -1.95872e+06 reflect 112 194 -1.95878e+06 expand 113 195 -1.95878e+06 reflect 114 196 -1.95878e+06 reflect 115 197 -1.95878e+06 reflect 116 199 -1.95888e+06 expand 117 200 -1.95888e+06 reflect 118 201 -1.95888e+06 reflect 119 203 -1.95898e+06 expand 120 204 -1.95898e+06 reflect 121 205 -1.95898e+06 reflect 122 207 -1.9591e+06 expand 123 208 -1.9591e+06 reflect 124 209 -1.9591e+06 reflect 125 211 -1.95917e+06 expand 126 213 -1.95933e+06 expand 127 214 -1.95933e+06 reflect 128 215 -1.95933e+06 reflect 129 217 -1.95945e+06 expand 130 218 -1.95945e+06 reflect 131 219 -1.95945e+06 reflect 132 221 -1.95961e+06 expand 133 222 -1.95961e+06 reflect 134 223 -1.95961e+06 reflect 135 225 -1.95961e+06 contract inside 136 227 -1.95964e+06 reflect 137 229 -1.95969e+06 reflect 138 230 -1.95969e+06 reflect 139 232 -1.95969e+06 contract inside 140 234 -1.95969e+06 contract inside 141 235 -1.95969e+06 reflect 142 236 -1.95969e+06 reflect 143 237 -1.95969e+06 reflect 144 238 -1.95969e+06 reflect 145 240 -1.95969e+06 contract outside 146 242 -1.95969e+06 contract inside 147 244 -1.95971e+06 reflect 148 246 -1.95976e+06 expand 149 248 -1.95976e+06 contract outside 150 249 -1.95976e+06 reflect 151 250 -1.95976e+06 reflect 152 252 -1.95981e+06 expand 153 253 -1.95981e+06 reflect 154 254 -1.95981e+06 reflect 155 256 -1.95996e+06 expand 156 257 -1.95996e+06 reflect 157 259 -1.96005e+06 expand 158 260 -1.96005e+06 reflect 159 262 -1.96018e+06 expand 160 263 -1.96018e+06 reflect 161 265 -1.96059e+06 expand 162 266 -1.96059e+06 reflect 163 267 -1.96059e+06 reflect 164 268 -1.96059e+06 reflect 165 270 -1.96078e+06 expand 166 272 -1.96114e+06 expand 167 274 -1.96135e+06 expand 168 275 -1.96135e+06 reflect 169 276 -1.96135e+06 reflect 170 277 -1.96135e+06 reflect 171 279 -1.96135e+06 contract inside 172 280 -1.96135e+06 reflect 173 282 -1.9615e+06 reflect 174 283 -1.9615e+06 reflect 175 285 -1.96172e+06 expand 176 287 -1.96179e+06 reflect 177 288 -1.96179e+06 reflect 178 290 -1.96179e+06 contract inside 179 291 -1.96179e+06 reflect 180 293 -1.96179e+06 contract inside 181 295 -1.96179e+06 contract inside 182 296 -1.96179e+06 reflect 183 298 -1.96179e+06 contract inside 184 300 -1.96179e+06 contract inside 185 302 -1.96183e+06 contract inside 186 304 -1.96188e+06 reflect 187 306 -1.96188e+06 contract inside 188 308 -1.96188e+06 contract inside 189 310 -1.9619e+06 contract inside 190 311 -1.9619e+06 reflect 191 313 -1.9619e+06 contract outside 192 314 -1.9619e+06 reflect 193 316 -1.96192e+06 reflect 194 318 -1.96195e+06 contract outside 195 319 -1.96195e+06 reflect 196 321 -1.96195e+06 contract inside 197 323 -1.96195e+06 contract inside 198 324 -1.96195e+06 reflect 199 325 -1.96195e+06 reflect 200 326 -1.96195e+06 reflect 201 328 -1.96195e+06 contract outside 202 330 -1.96195e+06 contract inside 203 331 -1.96195e+06 reflect 204 333 -1.96195e+06 contract inside 205 335 -1.96195e+06 contract inside 206 336 -1.96195e+06 reflect 207 338 -1.96195e+06 contract inside 208 339 -1.96195e+06 reflect 209 341 -1.96195e+06 contract inside 210 342 -1.96195e+06 reflect 211 350 -1.96196e+06 shrink 212 351 -1.96196e+06 reflect 213 353 -1.96196e+06 contract outside 214 354 -1.96196e+06 reflect 215 356 -1.96196e+06 contract inside 216 358 -1.96196e+06 contract outside 217 359 -1.96196e+06 reflect 218 360 -1.96196e+06 reflect 219 362 -1.96196e+06 contract inside 220 364 -1.96196e+06 contract inside 221 365 -1.96196e+06 reflect 222 367 -1.96196e+06 contract inside 223 368 -1.96196e+06 reflect 224 376 -1.96196e+06 shrink 225 377 -1.96196e+06 reflect 226 379 -1.96196e+06 contract outside 227 381 -1.96196e+06 contract inside 228 389 -1.96197e+06 shrink 229 391 -1.96197e+06 contract inside 230 392 -1.96197e+06 reflect 231 393 -1.96197e+06 reflect 232 395 -1.96197e+06 contract outside 233 396 -1.96197e+06 reflect 234 398 -1.96197e+06 contract inside 235 399 -1.96197e+06 reflect 236 400 -1.96197e+06 reflect 237 401 -1.96197e+06 reflect 238 409 -1.96197e+06 shrink 239 411 -1.96197e+06 contract inside 240 412 -1.96197e+06 reflect 241 414 -1.96197e+06 contract inside 242 415 -1.96197e+06 reflect 243 423 -1.96197e+06 shrink 244 424 -1.96197e+06 reflect 245 426 -1.96197e+06 contract outside 246 434 -1.96197e+06 shrink 247 442 -1.96197e+06 shrink 248 444 -1.96197e+06 contract inside 249 446 -1.96197e+06 contract inside 250 454 -1.96197e+06 shrink 251 462 -1.96197e+06 shrink 252 470 -1.96197e+06 shrink 253 478 -1.96197e+06 shrink 254 486 -1.96197e+06 shrink 255 494 -1.96197e+06 shrink 256 502 -1.96197e+06 shrink 257 510 -1.96197e+06 shrink 258 518 -1.96197e+06 shrink 259 526 -1.96197e+06 shrink 260 534 -1.96197e+06 shrink 261 542 -1.96197e+06 shrink 262 550 -1.96197e+06 shrink 263 558 -1.96197e+06 shrink 264 566 -1.96197e+06 shrink 265 574 -1.96197e+06 shrink 266 582 -1.96197e+06 shrink 267 590 -1.96197e+06 shrink 268 598 -1.96197e+06 shrink 269 606 -1.96197e+06 shrink 270 614 -1.96197e+06 shrink 271 622 -1.96197e+06 shrink 272 630 -1.96197e+06 shrink 273 638 -1.96197e+06 shrink 274 646 -1.96197e+06 shrink 275 654 -1.96197e+06 shrink 276 662 -1.96197e+06 shrink 277 670 -1.96197e+06 shrink 278 678 -1.96197e+06 shrink 279 686 -1.96197e+06 shrink Optimization terminated: the current x satisfies the termination criteria using OPTIONS.TolX of 0.000000e+00 and F(X) satisfies the convergence criteria using OPTIONS.TolFun of 5.000000e-07
results_joint_8=classify_normals([edge_powers_8(:,1),edge_lpr_8(:,1)],[edge_powers_8(:,2),edge_lpr_8(:,2)],'input_type','samp','plotmode',false);
Iteration Func-count min f(x) Procedure 0 1 -1.78592e+06 1 7 -1.78592e+06 initial simplex 2 9 -1.78592e+06 contract inside 3 11 -1.78592e+06 contract inside 4 13 -1.78592e+06 contract inside 5 15 -1.78699e+06 contract outside 6 17 -1.78713e+06 contract inside 7 19 -1.78734e+06 contract outside 8 21 -1.78746e+06 contract inside 9 23 -1.78777e+06 contract inside 10 25 -1.78777e+06 contract inside 11 27 -1.7878e+06 contract inside 12 29 -1.78788e+06 contract outside 13 31 -1.78788e+06 contract outside 14 33 -1.78792e+06 contract inside 15 35 -1.78837e+06 reflect 16 36 -1.78837e+06 reflect 17 38 -1.78837e+06 contract inside 18 39 -1.78837e+06 reflect 19 41 -1.78837e+06 contract inside 20 43 -1.78837e+06 contract inside 21 44 -1.78837e+06 reflect 22 46 -1.78893e+06 expand 23 47 -1.78893e+06 reflect 24 48 -1.78893e+06 reflect 25 49 -1.78893e+06 reflect 26 50 -1.78893e+06 reflect 27 51 -1.78893e+06 reflect 28 53 -1.78903e+06 expand 29 54 -1.78903e+06 reflect 30 56 -1.78903e+06 contract inside 31 58 -1.78924e+06 expand 32 59 -1.78924e+06 reflect 33 61 -1.7893e+06 reflect 34 63 -1.78992e+06 expand 35 64 -1.78992e+06 reflect 36 66 -1.78992e+06 contract inside 37 67 -1.78992e+06 reflect 38 69 -1.78996e+06 expand 39 71 -1.78999e+06 reflect 40 73 -1.79056e+06 expand 41 74 -1.79056e+06 reflect 42 76 -1.79157e+06 expand 43 77 -1.79157e+06 reflect 44 78 -1.79157e+06 reflect 45 79 -1.79157e+06 reflect 46 81 -1.79183e+06 reflect 47 83 -1.79314e+06 expand 48 84 -1.79314e+06 reflect 49 85 -1.79314e+06 reflect 50 87 -1.79341e+06 expand 51 89 -1.79449e+06 expand 52 91 -1.79567e+06 expand 53 92 -1.79567e+06 reflect 54 93 -1.79567e+06 reflect 55 95 -1.79608e+06 expand 56 97 -1.79781e+06 expand 57 99 -1.79889e+06 expand 58 101 -1.79889e+06 contract inside 59 102 -1.79889e+06 reflect 60 103 -1.79889e+06 reflect 61 104 -1.79889e+06 reflect 62 105 -1.79889e+06 reflect 63 107 -1.79889e+06 contract inside 64 108 -1.79889e+06 reflect 65 110 -1.79907e+06 reflect 66 112 -1.79907e+06 contract outside 67 114 -1.79907e+06 contract inside 68 115 -1.79907e+06 reflect 69 116 -1.79907e+06 reflect 70 118 -1.79914e+06 contract inside 71 120 -1.79914e+06 contract inside 72 122 -1.79927e+06 reflect 73 123 -1.79927e+06 reflect 74 125 -1.79927e+06 contract inside 75 127 -1.79927e+06 contract inside 76 128 -1.79927e+06 reflect 77 130 -1.79927e+06 contract inside 78 132 -1.79928e+06 contract inside 79 134 -1.79928e+06 contract inside 80 136 -1.79928e+06 contract inside 81 137 -1.79928e+06 reflect 82 139 -1.79928e+06 contract inside 83 140 -1.79928e+06 reflect 84 142 -1.79928e+06 contract outside 85 144 -1.79928e+06 contract inside 86 145 -1.79928e+06 reflect 87 146 -1.79928e+06 reflect 88 148 -1.79928e+06 contract inside 89 149 -1.79928e+06 reflect 90 150 -1.79928e+06 reflect 91 158 -1.79928e+06 shrink 92 160 -1.79928e+06 contract outside 93 161 -1.79928e+06 reflect 94 162 -1.79928e+06 reflect 95 164 -1.79931e+06 expand 96 166 -1.79931e+06 contract inside 97 168 -1.79931e+06 contract inside 98 176 -1.79931e+06 shrink 99 177 -1.79931e+06 reflect 100 178 -1.79931e+06 reflect 101 179 -1.79931e+06 reflect 102 180 -1.79931e+06 reflect 103 182 -1.79931e+06 contract inside 104 190 -1.79932e+06 shrink 105 191 -1.79932e+06 reflect 106 192 -1.79932e+06 reflect 107 194 -1.79932e+06 contract inside 108 196 -1.79932e+06 contract inside 109 198 -1.79932e+06 contract inside 110 200 -1.79932e+06 contract inside 111 208 -1.79932e+06 shrink 112 210 -1.79932e+06 contract outside 113 212 -1.79932e+06 contract inside 114 213 -1.79932e+06 reflect 115 215 -1.79933e+06 reflect 116 217 -1.79933e+06 contract inside 117 219 -1.79933e+06 contract inside 118 227 -1.79933e+06 shrink 119 229 -1.79933e+06 contract inside 120 231 -1.79933e+06 contract inside 121 233 -1.79933e+06 contract inside 122 234 -1.79933e+06 reflect 123 236 -1.79933e+06 contract inside 124 237 -1.79933e+06 reflect 125 239 -1.79933e+06 contract inside 126 240 -1.79933e+06 reflect 127 248 -1.79933e+06 shrink 128 249 -1.79933e+06 reflect 129 250 -1.79933e+06 reflect 130 251 -1.79933e+06 reflect 131 252 -1.79933e+06 reflect 132 254 -1.79933e+06 contract inside 133 255 -1.79933e+06 reflect 134 257 -1.79933e+06 contract outside 135 265 -1.79933e+06 shrink 136 267 -1.79933e+06 contract outside 137 268 -1.79933e+06 reflect 138 270 -1.79933e+06 contract inside 139 272 -1.79933e+06 contract inside 140 274 -1.79933e+06 contract inside 141 282 -1.79933e+06 shrink 142 284 -1.79933e+06 contract inside 143 286 -1.79933e+06 contract inside 144 288 -1.79933e+06 contract inside 145 296 -1.79933e+06 shrink 146 298 -1.79933e+06 contract inside 147 306 -1.79933e+06 shrink 148 314 -1.79933e+06 shrink 149 322 -1.79933e+06 shrink 150 330 -1.79933e+06 shrink 151 338 -1.79933e+06 shrink 152 346 -1.79933e+06 shrink 153 354 -1.79933e+06 shrink 154 362 -1.79933e+06 shrink 155 363 -1.79933e+06 reflect 156 365 -1.79933e+06 contract outside 157 373 -1.79933e+06 shrink 158 381 -1.79933e+06 shrink 159 389 -1.79933e+06 shrink 160 397 -1.79933e+06 shrink 161 405 -1.79933e+06 shrink 162 413 -1.79933e+06 shrink 163 421 -1.79933e+06 shrink 164 429 -1.79933e+06 shrink 165 437 -1.79933e+06 shrink 166 445 -1.79933e+06 shrink 167 453 -1.79933e+06 shrink 168 461 -1.79933e+06 shrink 169 469 -1.79933e+06 shrink 170 477 -1.79933e+06 shrink 171 485 -1.79933e+06 shrink 172 493 -1.79933e+06 shrink 173 501 -1.79933e+06 shrink 174 509 -1.79933e+06 shrink 175 517 -1.79933e+06 shrink 176 525 -1.79933e+06 shrink 177 533 -1.79933e+06 shrink 178 541 -1.79933e+06 shrink 179 549 -1.79933e+06 shrink Optimization terminated: the current x satisfies the termination criteria using OPTIONS.TolX of 0.000000e+00 and F(X) satisfies the convergence criteria using OPTIONS.TolFun of 5.000000e-07
results_dv_joint=classify_normals([results_joint_2.samp_opt_dv{1},results_joint_4.samp_opt_dv{1},results_joint_8.samp_opt_dv{1}],[results_joint_2.samp_opt_dv{2},results_joint_4.samp_opt_dv{2},results_joint_8.samp_opt_dv{2}],'input_type','samp');
Iteration Func-count min f(x) Procedure 0 1 -1.99145e+06 1 11 -1.9929e+06 initial simplex 2 12 -1.9929e+06 reflect 3 13 -1.9929e+06 reflect 4 14 -1.9929e+06 reflect 5 15 -1.9929e+06 reflect 6 16 -1.9929e+06 reflect 7 17 -1.9929e+06 reflect 8 19 -1.99367e+06 expand 9 20 -1.99367e+06 reflect 10 22 -1.99445e+06 expand 11 23 -1.99445e+06 reflect 12 24 -1.99445e+06 reflect 13 25 -1.99445e+06 reflect 14 26 -1.99445e+06 reflect 15 27 -1.99445e+06 reflect 16 29 -1.99523e+06 expand 17 30 -1.99523e+06 reflect 18 32 -1.99604e+06 expand 19 33 -1.99604e+06 reflect 20 34 -1.99604e+06 reflect 21 35 -1.99604e+06 reflect 22 36 -1.99604e+06 reflect 23 37 -1.99604e+06 reflect 24 39 -1.99682e+06 expand 25 40 -1.99682e+06 reflect 26 41 -1.99682e+06 reflect 27 42 -1.99682e+06 reflect 28 43 -1.99682e+06 reflect 29 45 -1.99721e+06 expand 30 46 -1.99721e+06 reflect 31 47 -1.99721e+06 reflect 32 48 -1.99721e+06 reflect 33 49 -1.99721e+06 reflect 34 50 -1.99721e+06 reflect 35 51 -1.99721e+06 reflect 36 53 -1.99734e+06 expand 37 54 -1.99734e+06 reflect 38 55 -1.99734e+06 reflect 39 57 -1.99782e+06 expand 40 58 -1.99782e+06 reflect 41 59 -1.99782e+06 reflect 42 60 -1.99782e+06 reflect 43 61 -1.99782e+06 reflect 44 63 -1.99782e+06 contract outside 45 64 -1.99782e+06 reflect 46 65 -1.99782e+06 reflect 47 67 -1.99796e+06 expand 48 69 -1.99796e+06 contract inside 49 70 -1.99796e+06 reflect 50 71 -1.99796e+06 reflect 51 72 -1.99796e+06 reflect 52 74 -1.99806e+06 expand 53 75 -1.99806e+06 reflect 54 76 -1.99806e+06 reflect 55 78 -1.99806e+06 reflect 56 80 -1.99809e+06 expand 57 81 -1.99809e+06 reflect 58 82 -1.99809e+06 reflect 59 84 -1.9981e+06 reflect 60 85 -1.9981e+06 reflect 61 86 -1.9981e+06 reflect 62 87 -1.9981e+06 reflect 63 89 -1.9981e+06 contract inside 64 91 -1.9981e+06 contract inside 65 93 -1.9981e+06 contract inside 66 94 -1.9981e+06 reflect 67 96 -1.9981e+06 contract inside 68 98 -1.9981e+06 contract inside 69 99 -1.9981e+06 reflect 70 101 -1.9981e+06 contract inside 71 103 -1.9981e+06 contract inside 72 104 -1.9981e+06 reflect 73 106 -1.9981e+06 contract inside 74 108 -1.9981e+06 contract inside 75 110 -1.9981e+06 reflect 76 111 -1.9981e+06 reflect 77 113 -1.9981e+06 contract inside 78 115 -1.9981e+06 contract inside 79 116 -1.9981e+06 reflect 80 118 -1.99811e+06 reflect 81 119 -1.99811e+06 reflect 82 120 -1.99811e+06 reflect 83 121 -1.99811e+06 reflect 84 123 -1.99811e+06 contract inside 85 125 -1.99811e+06 contract outside 86 126 -1.99811e+06 reflect 87 127 -1.99811e+06 reflect 88 128 -1.99811e+06 reflect 89 130 -1.99811e+06 contract inside 90 132 -1.99812e+06 expand 91 134 -1.99812e+06 contract outside 92 136 -1.99812e+06 contract inside 93 138 -1.99812e+06 contract inside 94 139 -1.99812e+06 reflect 95 140 -1.99812e+06 reflect 96 142 -1.99812e+06 contract inside 97 144 -1.99812e+06 contract inside 98 145 -1.99812e+06 reflect 99 146 -1.99812e+06 reflect 100 158 -1.99812e+06 shrink 101 160 -1.99812e+06 contract outside 102 161 -1.99812e+06 reflect 103 162 -1.99812e+06 reflect 104 164 -1.99812e+06 contract outside 105 166 -1.99812e+06 contract inside 106 168 -1.99812e+06 contract inside 107 170 -1.99812e+06 contract outside 108 171 -1.99812e+06 reflect 109 172 -1.99812e+06 reflect 110 174 -1.99812e+06 contract inside 111 176 -1.99812e+06 contract inside 112 178 -1.99812e+06 contract outside 113 180 -1.99812e+06 contract inside 114 181 -1.99812e+06 reflect 115 193 -1.99812e+06 shrink 116 194 -1.99812e+06 reflect 117 195 -1.99812e+06 reflect 118 196 -1.99812e+06 reflect 119 208 -1.99812e+06 shrink 120 210 -1.99812e+06 contract outside 121 212 -1.99812e+06 contract outside 122 213 -1.99812e+06 reflect 123 215 -1.99812e+06 contract outside 124 227 -1.99812e+06 shrink 125 228 -1.99812e+06 reflect 126 229 -1.99812e+06 reflect 127 230 -1.99812e+06 reflect 128 231 -1.99812e+06 reflect 129 232 -1.99812e+06 reflect 130 233 -1.99812e+06 reflect 131 235 -1.99812e+06 contract outside 132 247 -1.99812e+06 shrink 133 248 -1.99812e+06 reflect 134 260 -1.99812e+06 shrink 135 272 -1.99812e+06 shrink 136 273 -1.99812e+06 reflect 137 285 -1.99812e+06 shrink 138 287 -1.99812e+06 contract inside 139 299 -1.99812e+06 shrink 140 311 -1.99812e+06 shrink 141 323 -1.99812e+06 shrink 142 335 -1.99812e+06 shrink 143 347 -1.99812e+06 shrink 144 359 -1.99812e+06 shrink 145 371 -1.99812e+06 shrink 146 383 -1.99812e+06 shrink 147 395 -1.99812e+06 shrink 148 407 -1.99812e+06 shrink 149 419 -1.99812e+06 shrink 150 431 -1.99812e+06 shrink 151 443 -1.99812e+06 shrink 152 455 -1.99812e+06 shrink 153 467 -1.99812e+06 shrink 154 479 -1.99812e+06 shrink 155 491 -1.99812e+06 shrink 156 503 -1.99812e+06 shrink 157 515 -1.99812e+06 shrink 158 527 -1.99812e+06 shrink 159 539 -1.99812e+06 shrink 160 551 -1.99812e+06 shrink 161 563 -1.99812e+06 shrink 162 575 -1.99812e+06 shrink 163 587 -1.99812e+06 shrink 164 599 -1.99812e+06 shrink 165 611 -1.99812e+06 shrink 166 623 -1.99812e+06 shrink 167 635 -1.99812e+06 shrink 168 647 -1.99812e+06 shrink 169 659 -1.99812e+06 shrink 170 671 -1.99812e+06 shrink 171 683 -1.99812e+06 shrink 172 695 -1.99812e+06 shrink 173 707 -1.99812e+06 shrink 174 719 -1.99812e+06 shrink 175 731 -1.99812e+06 shrink 176 743 -1.99812e+06 shrink Optimization terminated: the current x satisfies the termination criteria using OPTIONS.TolX of 0.000000e+00 and F(X) satisfies the convergence criteria using OPTIONS.TolFun of 5.000000e-07
axis image; axis([-100 125 -50 75 -50 50]); view(-20,24)
xlabel('$q_s(${\boldmath$x$}$)$ (2px)','interpreter','latex');
ylabel('$q_s(${\boldmath$x$}$)$ (4px)','interpreter','latex');
zlabel('$q_s(${\boldmath$x$}$)$ (8px)','interpreter','latex');
results_all=classify_normals([edge_powers_2(:,1),edge_lpr_2(:,1),...
edge_powers_4(:,1),edge_lpr_4(:,1),...
edge_powers_8(:,1),edge_lpr_8(:,1)],...
[edge_powers_2(:,2),edge_lpr_2(:,2),...
edge_powers_4(:,2),edge_lpr_4(:,2),...
edge_powers_8(:,2),edge_lpr_8(:,2)],'input_type','samp');
Iteration Func-count min f(x) Procedure 0 1 -1.99471e+06 1 29 -1.99689e+06 initial simplex 2 30 -1.99689e+06 reflect 3 31 -1.99689e+06 reflect 4 32 -1.99689e+06 reflect 5 34 -1.99689e+06 contract inside 6 36 -1.99689e+06 contract inside 7 38 -1.99689e+06 contract inside 8 40 -1.99689e+06 contract inside 9 41 -1.99689e+06 reflect 10 43 -1.99689e+06 contract inside 11 45 -1.99689e+06 contract inside 12 46 -1.99689e+06 reflect 13 48 -1.99689e+06 contract inside 14 50 -1.99689e+06 contract inside 15 52 -1.99689e+06 contract inside 16 54 -1.99691e+06 contract inside 17 56 -1.99718e+06 reflect 18 57 -1.99718e+06 reflect 19 59 -1.99721e+06 contract inside 20 61 -1.99749e+06 reflect 21 63 -1.99749e+06 contract inside 22 64 -1.99749e+06 reflect 23 65 -1.99749e+06 reflect 24 66 -1.99749e+06 reflect 25 67 -1.99749e+06 reflect 26 68 -1.99749e+06 reflect 27 69 -1.99749e+06 reflect 28 70 -1.99749e+06 reflect 29 72 -1.99749e+06 contract inside 30 74 -1.99749e+06 contract inside 31 76 -1.99749e+06 contract inside 32 78 -1.99749e+06 contract inside 33 80 -1.99749e+06 contract inside 34 82 -1.99749e+06 contract inside 35 84 -1.99749e+06 contract inside 36 86 -1.99749e+06 contract inside 37 88 -1.99749e+06 contract inside 38 90 -1.99749e+06 contract inside 39 91 -1.99749e+06 reflect 40 93 -1.99749e+06 contract outside 41 94 -1.99749e+06 reflect 42 96 -1.99749e+06 contract inside 43 98 -1.99749e+06 contract inside 44 100 -1.99749e+06 contract inside 45 101 -1.99749e+06 reflect 46 102 -1.99749e+06 reflect 47 103 -1.99749e+06 reflect 48 104 -1.99749e+06 reflect 49 106 -1.99749e+06 contract inside 50 108 -1.99749e+06 contract inside 51 110 -1.99749e+06 contract inside 52 112 -1.99749e+06 contract inside 53 114 -1.99749e+06 contract inside 54 116 -1.99749e+06 contract inside 55 118 -1.99749e+06 contract inside 56 119 -1.99749e+06 reflect 57 121 -1.99749e+06 contract inside 58 122 -1.99749e+06 reflect 59 124 -1.99749e+06 contract outside 60 126 -1.99749e+06 contract inside 61 128 -1.99752e+06 contract inside 62 130 -1.99752e+06 contract inside 63 132 -1.99752e+06 contract inside 64 133 -1.99752e+06 reflect 65 135 -1.99752e+06 contract outside 66 137 -1.99752e+06 contract inside 67 139 -1.99752e+06 contract inside 68 141 -1.99752e+06 contract inside 69 143 -1.99754e+06 contract inside 70 145 -1.99757e+06 contract inside 71 146 -1.99757e+06 reflect 72 148 -1.99757e+06 contract outside 73 150 -1.99757e+06 contract outside 74 151 -1.99757e+06 reflect 75 152 -1.99757e+06 reflect 76 154 -1.99757e+06 contract inside 77 155 -1.99757e+06 reflect 78 156 -1.99757e+06 reflect 79 158 -1.99758e+06 contract inside 80 159 -1.99758e+06 reflect 81 161 -1.99758e+06 contract inside 82 163 -1.99758e+06 contract inside 83 164 -1.99758e+06 reflect 84 166 -1.99758e+06 contract inside 85 167 -1.99758e+06 reflect 86 168 -1.99758e+06 reflect 87 170 -1.99758e+06 contract inside 88 171 -1.99758e+06 reflect 89 172 -1.99758e+06 reflect 90 173 -1.99758e+06 reflect 91 175 -1.99759e+06 contract inside 92 176 -1.99759e+06 reflect 93 178 -1.99759e+06 contract inside 94 179 -1.99759e+06 reflect 95 181 -1.99759e+06 contract inside 96 183 -1.9976e+06 contract inside 97 184 -1.9976e+06 reflect 98 186 -1.9976e+06 contract outside 99 188 -1.9976e+06 contract inside 100 190 -1.99761e+06 contract inside 101 192 -1.99761e+06 contract inside 102 193 -1.99761e+06 reflect 103 194 -1.99761e+06 reflect 104 195 -1.99761e+06 reflect 105 197 -1.99761e+06 contract inside 106 198 -1.99761e+06 reflect 107 199 -1.99761e+06 reflect 108 200 -1.99761e+06 reflect 109 201 -1.99761e+06 reflect 110 202 -1.99761e+06 reflect 111 203 -1.99761e+06 reflect 112 205 -1.99761e+06 contract inside 113 206 -1.99761e+06 reflect 114 207 -1.99761e+06 reflect 115 209 -1.99761e+06 contract inside 116 211 -1.99762e+06 reflect 117 213 -1.99762e+06 contract inside 118 215 -1.99762e+06 contract inside 119 216 -1.99762e+06 reflect 120 217 -1.99762e+06 reflect 121 218 -1.99762e+06 reflect 122 220 -1.99762e+06 contract inside 123 221 -1.99762e+06 reflect 124 222 -1.99762e+06 reflect 125 223 -1.99762e+06 reflect 126 224 -1.99762e+06 reflect 127 226 -1.99762e+06 contract inside 128 228 -1.99763e+06 reflect 129 229 -1.99763e+06 reflect 130 231 -1.99763e+06 contract inside 131 232 -1.99763e+06 reflect 132 234 -1.99763e+06 contract inside 133 235 -1.99763e+06 reflect 134 237 -1.99765e+06 reflect 135 238 -1.99765e+06 reflect 136 239 -1.99765e+06 reflect 137 240 -1.99765e+06 reflect 138 242 -1.99766e+06 reflect 139 243 -1.99766e+06 reflect 140 244 -1.99766e+06 reflect 141 245 -1.99766e+06 reflect 142 247 -1.99766e+06 contract inside 143 249 -1.99766e+06 contract inside 144 250 -1.99766e+06 reflect 145 251 -1.99766e+06 reflect 146 252 -1.99766e+06 reflect 147 253 -1.99766e+06 reflect 148 255 -1.99766e+06 contract inside 149 257 -1.99766e+06 contract inside 150 259 -1.99766e+06 contract inside 151 261 -1.99766e+06 contract inside 152 263 -1.99766e+06 contract inside 153 265 -1.99768e+06 expand 154 266 -1.99768e+06 reflect 155 267 -1.99768e+06 reflect 156 269 -1.99768e+06 contract inside 157 271 -1.99768e+06 contract inside 158 272 -1.99768e+06 reflect 159 274 -1.99768e+06 contract inside 160 275 -1.99768e+06 reflect 161 276 -1.99768e+06 reflect 162 277 -1.99768e+06 reflect 163 278 -1.99768e+06 reflect 164 279 -1.99768e+06 reflect 165 280 -1.99768e+06 reflect 166 281 -1.99768e+06 reflect 167 282 -1.99768e+06 reflect 168 283 -1.99768e+06 reflect 169 284 -1.99768e+06 reflect 170 285 -1.99768e+06 reflect 171 287 -1.99768e+06 contract outside 172 288 -1.99768e+06 reflect 173 290 -1.9977e+06 reflect 174 291 -1.9977e+06 reflect 175 292 -1.9977e+06 reflect 176 293 -1.9977e+06 reflect 177 294 -1.9977e+06 reflect 178 295 -1.9977e+06 reflect 179 297 -1.9977e+06 contract inside 180 298 -1.9977e+06 reflect 181 299 -1.9977e+06 reflect 182 300 -1.9977e+06 reflect 183 301 -1.9977e+06 reflect 184 302 -1.9977e+06 reflect 185 303 -1.9977e+06 reflect 186 304 -1.9977e+06 reflect 187 305 -1.9977e+06 reflect 188 306 -1.9977e+06 reflect 189 307 -1.9977e+06 reflect 190 308 -1.9977e+06 reflect 191 309 -1.9977e+06 reflect 192 310 -1.9977e+06 reflect 193 311 -1.9977e+06 reflect 194 312 -1.9977e+06 reflect 195 313 -1.9977e+06 reflect 196 314 -1.9977e+06 reflect 197 316 -1.9977e+06 contract inside 198 317 -1.9977e+06 reflect 199 318 -1.9977e+06 reflect 200 319 -1.9977e+06 reflect 201 320 -1.9977e+06 reflect 202 322 -1.99774e+06 expand 203 323 -1.99774e+06 reflect 204 324 -1.99774e+06 reflect 205 326 -1.99774e+06 contract inside 206 327 -1.99774e+06 reflect 207 329 -1.99774e+06 contract inside 208 330 -1.99774e+06 reflect 209 331 -1.99774e+06 reflect 210 333 -1.99774e+06 contract inside 211 335 -1.99774e+06 contract inside 212 336 -1.99774e+06 reflect 213 337 -1.99774e+06 reflect 214 338 -1.99774e+06 reflect 215 339 -1.99774e+06 reflect 216 340 -1.99774e+06 reflect 217 342 -1.99774e+06 contract inside 218 344 -1.99774e+06 contract inside 219 345 -1.99774e+06 reflect 220 347 -1.99774e+06 contract inside 221 348 -1.99774e+06 reflect 222 349 -1.99774e+06 reflect 223 350 -1.99774e+06 reflect 224 351 -1.99774e+06 reflect 225 352 -1.99774e+06 reflect 226 353 -1.99774e+06 reflect 227 354 -1.99774e+06 reflect 228 355 -1.99774e+06 reflect 229 356 -1.99774e+06 reflect 230 357 -1.99774e+06 reflect 231 358 -1.99774e+06 reflect 232 359 -1.99774e+06 reflect 233 361 -1.99777e+06 expand 234 363 -1.99777e+06 contract inside 235 364 -1.99777e+06 reflect 236 365 -1.99777e+06 reflect 237 366 -1.99777e+06 reflect 238 367 -1.99777e+06 reflect 239 368 -1.99777e+06 reflect 240 369 -1.99777e+06 reflect 241 370 -1.99777e+06 reflect 242 371 -1.99777e+06 reflect 243 372 -1.99777e+06 reflect 244 373 -1.99777e+06 reflect 245 374 -1.99777e+06 reflect 246 375 -1.99777e+06 reflect 247 376 -1.99777e+06 reflect 248 377 -1.99777e+06 reflect 249 378 -1.99777e+06 reflect 250 379 -1.99777e+06 reflect 251 381 -1.99777e+06 contract inside 252 382 -1.99777e+06 reflect 253 383 -1.99777e+06 reflect 254 384 -1.99777e+06 reflect 255 385 -1.99777e+06 reflect 256 386 -1.99777e+06 reflect 257 388 -1.99777e+06 contract inside 258 389 -1.99777e+06 reflect 259 391 -1.9978e+06 expand 260 392 -1.9978e+06 reflect 261 393 -1.9978e+06 reflect 262 394 -1.9978e+06 reflect 263 395 -1.9978e+06 reflect 264 396 -1.9978e+06 reflect 265 397 -1.9978e+06 reflect 266 398 -1.9978e+06 reflect 267 399 -1.9978e+06 reflect 268 400 -1.9978e+06 reflect 269 401 -1.9978e+06 reflect 270 402 -1.9978e+06 reflect 271 404 -1.9978e+06 contract inside 272 405 -1.9978e+06 reflect 273 407 -1.9978e+06 reflect 274 408 -1.9978e+06 reflect 275 409 -1.9978e+06 reflect 276 410 -1.9978e+06 reflect 277 411 -1.9978e+06 reflect 278 412 -1.9978e+06 reflect 279 413 -1.9978e+06 reflect 280 414 -1.9978e+06 reflect 281 416 -1.99781e+06 expand 282 417 -1.99781e+06 reflect 283 418 -1.99781e+06 reflect 284 419 -1.99781e+06 reflect 285 420 -1.99781e+06 reflect 286 421 -1.99781e+06 reflect 287 422 -1.99781e+06 reflect 288 424 -1.99783e+06 expand 289 425 -1.99783e+06 reflect 290 426 -1.99783e+06 reflect 291 427 -1.99783e+06 reflect 292 428 -1.99783e+06 reflect 293 430 -1.99786e+06 expand 294 431 -1.99786e+06 reflect 295 432 -1.99786e+06 reflect 296 433 -1.99786e+06 reflect 297 434 -1.99786e+06 reflect 298 435 -1.99786e+06 reflect 299 436 -1.99786e+06 reflect 300 437 -1.99786e+06 reflect 301 438 -1.99786e+06 reflect 302 439 -1.99786e+06 reflect 303 440 -1.99786e+06 reflect 304 441 -1.99786e+06 reflect 305 442 -1.99786e+06 reflect 306 443 -1.99786e+06 reflect 307 444 -1.99786e+06 reflect 308 445 -1.99786e+06 reflect 309 446 -1.99786e+06 reflect 310 447 -1.99786e+06 reflect 311 448 -1.99786e+06 reflect 312 449 -1.99786e+06 reflect 313 450 -1.99786e+06 reflect 314 451 -1.99786e+06 reflect 315 452 -1.99786e+06 reflect 316 453 -1.99786e+06 reflect 317 454 -1.99786e+06 reflect 318 455 -1.99786e+06 reflect 319 456 -1.99786e+06 reflect 320 457 -1.99786e+06 reflect 321 458 -1.99786e+06 reflect 322 459 -1.99786e+06 reflect 323 460 -1.99786e+06 reflect 324 461 -1.99786e+06 reflect 325 462 -1.99786e+06 reflect 326 463 -1.99786e+06 reflect 327 464 -1.99786e+06 reflect 328 466 -1.99786e+06 contract inside 329 467 -1.99786e+06 reflect 330 468 -1.99786e+06 reflect 331 469 -1.99786e+06 reflect 332 470 -1.99786e+06 reflect 333 471 -1.99786e+06 reflect 334 472 -1.99786e+06 reflect 335 473 -1.99786e+06 reflect 336 474 -1.99786e+06 reflect 337 476 -1.99786e+06 contract inside 338 477 -1.99786e+06 reflect 339 478 -1.99786e+06 reflect 340 479 -1.99786e+06 reflect 341 481 -1.99786e+06 contract inside 342 482 -1.99786e+06 reflect 343 483 -1.99786e+06 reflect 344 484 -1.99786e+06 reflect 345 486 -1.99786e+06 contract inside 346 488 -1.99786e+06 contract inside 347 489 -1.99786e+06 reflect 348 490 -1.99786e+06 reflect 349 491 -1.99786e+06 reflect 350 492 -1.99786e+06 reflect 351 494 -1.99786e+06 contract inside 352 495 -1.99786e+06 reflect 353 496 -1.99786e+06 reflect 354 498 -1.99786e+06 contract inside 355 499 -1.99786e+06 reflect 356 500 -1.99786e+06 reflect 357 502 -1.99786e+06 contract inside 358 503 -1.99786e+06 reflect 359 505 -1.99786e+06 contract inside 360 506 -1.99786e+06 reflect 361 508 -1.99786e+06 reflect 362 510 -1.99787e+06 reflect 363 511 -1.99787e+06 reflect 364 512 -1.99787e+06 reflect 365 513 -1.99787e+06 reflect 366 515 -1.99789e+06 reflect 367 516 -1.99789e+06 reflect 368 517 -1.99789e+06 reflect 369 518 -1.99789e+06 reflect 370 519 -1.99789e+06 reflect 371 520 -1.99789e+06 reflect 372 521 -1.99789e+06 reflect 373 522 -1.99789e+06 reflect 374 523 -1.99789e+06 reflect 375 524 -1.99789e+06 reflect 376 525 -1.99789e+06 reflect 377 526 -1.99789e+06 reflect 378 527 -1.99789e+06 reflect 379 528 -1.99789e+06 reflect 380 529 -1.99789e+06 reflect 381 530 -1.99789e+06 reflect 382 531 -1.99789e+06 reflect 383 532 -1.99789e+06 reflect 384 533 -1.99789e+06 reflect 385 534 -1.99789e+06 reflect 386 535 -1.99789e+06 reflect 387 536 -1.99789e+06 reflect 388 538 -1.9979e+06 expand 389 539 -1.9979e+06 reflect 390 540 -1.9979e+06 reflect 391 541 -1.9979e+06 reflect 392 542 -1.9979e+06 reflect 393 543 -1.9979e+06 reflect 394 544 -1.9979e+06 reflect 395 545 -1.9979e+06 reflect 396 546 -1.9979e+06 reflect 397 547 -1.9979e+06 reflect 398 548 -1.9979e+06 reflect 399 549 -1.9979e+06 reflect 400 550 -1.9979e+06 reflect 401 551 -1.9979e+06 reflect 402 552 -1.9979e+06 reflect 403 553 -1.9979e+06 reflect 404 555 -1.99793e+06 expand 405 556 -1.99793e+06 reflect 406 557 -1.99793e+06 reflect 407 558 -1.99793e+06 reflect 408 559 -1.99793e+06 reflect 409 560 -1.99793e+06 reflect 410 561 -1.99793e+06 reflect 411 562 -1.99793e+06 reflect 412 563 -1.99793e+06 reflect 413 564 -1.99793e+06 reflect 414 565 -1.99793e+06 reflect 415 566 -1.99793e+06 reflect 416 567 -1.99793e+06 reflect 417 568 -1.99793e+06 reflect 418 569 -1.99793e+06 reflect 419 570 -1.99793e+06 reflect 420 571 -1.99793e+06 reflect 421 572 -1.99793e+06 reflect 422 573 -1.99793e+06 reflect 423 574 -1.99793e+06 reflect 424 576 -1.99795e+06 expand 425 577 -1.99795e+06 reflect 426 578 -1.99795e+06 reflect 427 579 -1.99795e+06 reflect 428 580 -1.99795e+06 reflect 429 581 -1.99795e+06 reflect 430 582 -1.99795e+06 reflect 431 583 -1.99795e+06 reflect 432 584 -1.99795e+06 reflect 433 585 -1.99795e+06 reflect 434 586 -1.99795e+06 reflect 435 587 -1.99795e+06 reflect 436 588 -1.99795e+06 reflect 437 590 -1.99797e+06 expand 438 591 -1.99797e+06 reflect 439 592 -1.99797e+06 reflect 440 593 -1.99797e+06 reflect 441 594 -1.99797e+06 reflect 442 595 -1.99797e+06 reflect 443 596 -1.99797e+06 reflect 444 597 -1.99797e+06 reflect 445 598 -1.99797e+06 reflect 446 599 -1.99797e+06 reflect 447 601 -1.99799e+06 expand 448 602 -1.99799e+06 reflect 449 603 -1.99799e+06 reflect 450 604 -1.99799e+06 reflect 451 605 -1.99799e+06 reflect 452 606 -1.99799e+06 reflect 453 607 -1.99799e+06 reflect 454 609 -1.99801e+06 expand 455 610 -1.99801e+06 reflect 456 611 -1.99801e+06 reflect 457 612 -1.99801e+06 reflect 458 614 -1.99803e+06 expand 459 615 -1.99803e+06 reflect 460 616 -1.99803e+06 reflect 461 617 -1.99803e+06 reflect 462 618 -1.99803e+06 reflect 463 619 -1.99803e+06 reflect 464 620 -1.99803e+06 reflect 465 621 -1.99803e+06 reflect 466 622 -1.99803e+06 reflect 467 623 -1.99803e+06 reflect 468 624 -1.99803e+06 reflect 469 625 -1.99803e+06 reflect 470 626 -1.99803e+06 reflect 471 627 -1.99803e+06 reflect 472 628 -1.99803e+06 reflect 473 629 -1.99803e+06 reflect 474 630 -1.99803e+06 reflect 475 631 -1.99803e+06 reflect 476 632 -1.99803e+06 reflect 477 633 -1.99803e+06 reflect 478 634 -1.99803e+06 reflect 479 635 -1.99803e+06 reflect 480 637 -1.99806e+06 expand 481 638 -1.99806e+06 reflect 482 639 -1.99806e+06 reflect 483 640 -1.99806e+06 reflect 484 641 -1.99806e+06 reflect 485 642 -1.99806e+06 reflect 486 643 -1.99806e+06 reflect 487 644 -1.99806e+06 reflect 488 645 -1.99806e+06 reflect 489 646 -1.99806e+06 reflect 490 647 -1.99806e+06 reflect 491 649 -1.99808e+06 expand 492 650 -1.99808e+06 reflect 493 651 -1.99808e+06 reflect 494 652 -1.99808e+06 reflect 495 653 -1.99808e+06 reflect 496 654 -1.99808e+06 reflect 497 655 -1.99808e+06 reflect 498 656 -1.99808e+06 reflect 499 657 -1.99808e+06 reflect 500 658 -1.99808e+06 reflect 501 659 -1.99808e+06 reflect 502 660 -1.99808e+06 reflect 503 662 -1.99811e+06 expand 504 663 -1.99811e+06 reflect 505 664 -1.99811e+06 reflect 506 665 -1.99811e+06 reflect 507 666 -1.99811e+06 reflect 508 667 -1.99811e+06 reflect 509 668 -1.99811e+06 reflect 510 669 -1.99811e+06 reflect 511 670 -1.99811e+06 reflect 512 671 -1.99811e+06 reflect 513 672 -1.99811e+06 reflect 514 673 -1.99811e+06 reflect 515 674 -1.99811e+06 reflect 516 675 -1.99811e+06 reflect 517 676 -1.99811e+06 reflect 518 678 -1.99815e+06 expand 519 679 -1.99815e+06 reflect 520 680 -1.99815e+06 reflect 521 681 -1.99815e+06 reflect 522 682 -1.99815e+06 reflect 523 683 -1.99815e+06 reflect 524 684 -1.99815e+06 reflect 525 685 -1.99815e+06 reflect 526 686 -1.99815e+06 reflect 527 687 -1.99815e+06 reflect 528 688 -1.99815e+06 reflect 529 689 -1.99815e+06 reflect 530 690 -1.99815e+06 reflect 531 691 -1.99815e+06 reflect 532 692 -1.99815e+06 reflect 533 693 -1.99815e+06 reflect 534 695 -1.99817e+06 expand 535 697 -1.99818e+06 expand 536 698 -1.99818e+06 reflect 537 699 -1.99818e+06 reflect 538 700 -1.99818e+06 reflect 539 701 -1.99818e+06 reflect 540 702 -1.99818e+06 reflect 541 703 -1.99818e+06 reflect 542 704 -1.99818e+06 reflect 543 706 -1.9982e+06 expand 544 707 -1.9982e+06 reflect 545 708 -1.9982e+06 reflect 546 709 -1.9982e+06 reflect 547 710 -1.9982e+06 reflect 548 711 -1.9982e+06 reflect 549 712 -1.9982e+06 reflect 550 713 -1.9982e+06 reflect 551 714 -1.9982e+06 reflect 552 716 -1.99822e+06 expand 553 717 -1.99822e+06 reflect 554 718 -1.99822e+06 reflect 555 719 -1.99822e+06 reflect 556 720 -1.99822e+06 reflect 557 721 -1.99822e+06 reflect 558 722 -1.99822e+06 reflect 559 724 -1.99825e+06 expand 560 725 -1.99825e+06 reflect 561 726 -1.99825e+06 reflect 562 727 -1.99825e+06 reflect 563 728 -1.99825e+06 reflect 564 729 -1.99825e+06 reflect 565 730 -1.99825e+06 reflect 566 731 -1.99825e+06 reflect 567 732 -1.99825e+06 reflect 568 733 -1.99825e+06 reflect 569 734 -1.99825e+06 reflect 570 736 -1.99826e+06 expand 571 738 -1.99827e+06 expand 572 739 -1.99827e+06 reflect 573 740 -1.99827e+06 reflect 574 741 -1.99827e+06 reflect 575 742 -1.99827e+06 reflect 576 743 -1.99827e+06 reflect 577 744 -1.99827e+06 reflect 578 745 -1.99827e+06 reflect 579 746 -1.99827e+06 reflect 580 747 -1.99827e+06 reflect 581 749 -1.9983e+06 expand 582 750 -1.9983e+06 reflect 583 751 -1.9983e+06 reflect 584 752 -1.9983e+06 reflect 585 753 -1.9983e+06 reflect 586 754 -1.9983e+06 reflect 587 755 -1.9983e+06 reflect 588 756 -1.9983e+06 reflect 589 757 -1.9983e+06 reflect 590 758 -1.9983e+06 reflect 591 760 -1.99831e+06 expand 592 761 -1.99831e+06 reflect 593 762 -1.99831e+06 reflect 594 763 -1.99831e+06 reflect 595 764 -1.99831e+06 reflect 596 765 -1.99831e+06 reflect 597 766 -1.99831e+06 reflect 598 767 -1.99831e+06 reflect 599 768 -1.99831e+06 reflect 600 769 -1.99831e+06 reflect 601 770 -1.99831e+06 reflect 602 771 -1.99831e+06 reflect 603 772 -1.99831e+06 reflect 604 773 -1.99831e+06 reflect 605 774 -1.99831e+06 reflect 606 775 -1.99831e+06 reflect 607 776 -1.99831e+06 reflect 608 777 -1.99831e+06 reflect 609 778 -1.99831e+06 reflect 610 779 -1.99831e+06 reflect 611 780 -1.99831e+06 reflect 612 781 -1.99831e+06 reflect 613 782 -1.99831e+06 reflect 614 783 -1.99831e+06 reflect 615 784 -1.99831e+06 reflect 616 785 -1.99831e+06 reflect 617 786 -1.99831e+06 reflect 618 788 -1.99832e+06 reflect 619 789 -1.99832e+06 reflect 620 790 -1.99832e+06 reflect 621 791 -1.99832e+06 reflect 622 792 -1.99832e+06 reflect 623 793 -1.99832e+06 reflect 624 794 -1.99832e+06 reflect 625 795 -1.99832e+06 reflect 626 796 -1.99832e+06 reflect 627 797 -1.99832e+06 reflect 628 798 -1.99832e+06 reflect 629 799 -1.99832e+06 reflect 630 801 -1.99832e+06 contract inside 631 802 -1.99832e+06 reflect 632 803 -1.99832e+06 reflect 633 805 -1.99832e+06 contract inside 634 807 -1.99832e+06 contract inside 635 808 -1.99832e+06 reflect 636 809 -1.99832e+06 reflect 637 810 -1.99832e+06 reflect 638 811 -1.99832e+06 reflect 639 812 -1.99832e+06 reflect 640 814 -1.99832e+06 contract inside 641 815 -1.99832e+06 reflect 642 817 -1.99832e+06 contract inside 643 818 -1.99832e+06 reflect 644 819 -1.99832e+06 reflect 645 820 -1.99832e+06 reflect 646 822 -1.99833e+06 contract inside 647 823 -1.99833e+06 reflect 648 825 -1.99833e+06 contract inside 649 827 -1.99833e+06 contract inside 650 829 -1.99833e+06 contract inside 651 831 -1.99833e+06 contract inside 652 833 -1.99833e+06 contract inside 653 834 -1.99833e+06 reflect 654 835 -1.99833e+06 reflect 655 837 -1.99833e+06 contract inside 656 839 -1.99833e+06 contract inside 657 841 -1.99833e+06 contract outside 658 842 -1.99833e+06 reflect 659 843 -1.99833e+06 reflect 660 845 -1.99833e+06 contract inside 661 846 -1.99833e+06 reflect 662 847 -1.99833e+06 reflect 663 848 -1.99833e+06 reflect 664 849 -1.99833e+06 reflect 665 850 -1.99833e+06 reflect 666 851 -1.99833e+06 reflect 667 852 -1.99833e+06 reflect 668 854 -1.99833e+06 contract inside 669 855 -1.99833e+06 reflect 670 856 -1.99833e+06 reflect 671 857 -1.99833e+06 reflect 672 858 -1.99833e+06 reflect 673 859 -1.99833e+06 reflect 674 860 -1.99833e+06 reflect 675 861 -1.99833e+06 reflect 676 891 -1.99833e+06 shrink 677 893 -1.99833e+06 contract outside 678 894 -1.99833e+06 reflect 679 895 -1.99833e+06 reflect 680 896 -1.99833e+06 reflect 681 897 -1.99833e+06 reflect 682 898 -1.99833e+06 reflect 683 899 -1.99833e+06 reflect 684 900 -1.99833e+06 reflect 685 902 -1.99833e+06 contract inside 686 904 -1.99833e+06 contract inside 687 905 -1.99833e+06 reflect 688 906 -1.99833e+06 reflect 689 908 -1.99833e+06 contract inside 690 910 -1.99833e+06 contract inside 691 912 -1.99833e+06 contract inside 692 913 -1.99833e+06 reflect 693 915 -1.99833e+06 contract inside 694 917 -1.99833e+06 contract inside 695 919 -1.99833e+06 contract inside 696 921 -1.99833e+06 contract inside 697 923 -1.99833e+06 contract inside 698 925 -1.99833e+06 contract inside 699 926 -1.99833e+06 reflect 700 928 -1.99833e+06 contract inside 701 929 -1.99833e+06 reflect 702 931 -1.99833e+06 contract inside 703 932 -1.99833e+06 reflect 704 934 -1.99833e+06 contract inside 705 935 -1.99833e+06 reflect 706 965 -1.99833e+06 shrink 707 966 -1.99833e+06 reflect 708 968 -1.99833e+06 contract inside 709 970 -1.99833e+06 contract inside 710 972 -1.99833e+06 contract inside 711 974 -1.99833e+06 contract inside 712 975 -1.99833e+06 reflect 713 976 -1.99833e+06 reflect 714 977 -1.99833e+06 reflect 715 979 -1.99833e+06 contract inside 716 981 -1.99833e+06 contract inside 717 982 -1.99833e+06 reflect 718 983 -1.99833e+06 reflect 719 984 -1.99833e+06 reflect 720 986 -1.99833e+06 contract inside 721 987 -1.99833e+06 reflect 722 988 -1.99833e+06 reflect 723 990 -1.99833e+06 contract inside 724 992 -1.99833e+06 contract inside 725 993 -1.99833e+06 reflect 726 994 -1.99833e+06 reflect 727 995 -1.99833e+06 reflect 728 997 -1.99833e+06 contract inside 729 1027 -1.99833e+06 shrink 730 1028 -1.99833e+06 reflect 731 1029 -1.99833e+06 reflect 732 1031 -1.99833e+06 contract inside 733 1032 -1.99833e+06 reflect 734 1033 -1.99833e+06 reflect 735 1034 -1.99833e+06 reflect 736 1036 -1.99833e+06 contract inside 737 1037 -1.99833e+06 reflect 738 1038 -1.99833e+06 reflect 739 1039 -1.99833e+06 reflect 740 1041 -1.99833e+06 contract inside 741 1043 -1.99833e+06 contract inside 742 1045 -1.99833e+06 contract inside 743 1075 -1.99833e+06 shrink 744 1076 -1.99833e+06 reflect 745 1078 -1.99833e+06 contract inside 746 1108 -1.99833e+06 shrink 747 1109 -1.99833e+06 reflect 748 1110 -1.99833e+06 reflect 749 1111 -1.99833e+06 reflect 750 1112 -1.99833e+06 reflect 751 1113 -1.99833e+06 reflect 752 1114 -1.99833e+06 reflect 753 1144 -1.99833e+06 shrink 754 1145 -1.99833e+06 reflect 755 1175 -1.99833e+06 shrink 756 1177 -1.99833e+06 contract inside 757 1179 -1.99833e+06 contract inside 758 1180 -1.99833e+06 reflect 759 1182 -1.99833e+06 contract outside 760 1212 -1.99833e+06 shrink 761 1242 -1.99833e+06 shrink 762 1272 -1.99833e+06 shrink 763 1302 -1.99833e+06 shrink 764 1332 -1.99833e+06 shrink 765 1362 -1.99833e+06 shrink 766 1392 -1.99833e+06 shrink 767 1422 -1.99833e+06 shrink 768 1452 -1.99833e+06 shrink 769 1482 -1.99833e+06 shrink 770 1512 -1.99833e+06 shrink 771 1542 -1.99833e+06 shrink 772 1572 -1.99833e+06 shrink 773 1602 -1.99833e+06 shrink 774 1632 -1.99833e+06 shrink 775 1662 -1.99833e+06 shrink 776 1692 -1.99833e+06 shrink 777 1722 -1.99833e+06 shrink 778 1752 -1.99833e+06 shrink 779 1782 -1.99833e+06 shrink 780 1812 -1.99833e+06 shrink 781 1842 -1.99833e+06 shrink 782 1872 -1.99833e+06 shrink 783 1902 -1.99833e+06 shrink 784 1932 -1.99833e+06 shrink 785 1962 -1.99833e+06 shrink 786 1992 -1.99833e+06 shrink 787 2022 -1.99833e+06 shrink 788 2052 -1.99833e+06 shrink 789 2082 -1.99833e+06 shrink 790 2112 -1.99833e+06 shrink 791 2142 -1.99833e+06 shrink 792 2172 -1.99833e+06 shrink 793 2202 -1.99833e+06 shrink 794 2232 -1.99833e+06 shrink Optimization terminated: the current x satisfies the termination criteria using OPTIONS.TolX of 0.000000e+00 and F(X) satisfies the convergence criteria using OPTIONS.TolFun of 5.000000e-07
results_all_samp_opt=classify_normals([edge_powers_2(:,1),edge_lpr_2(:,1),...
edge_powers_4(:,1),edge_lpr_4(:,1),...
edge_powers_8(:,1),edge_lpr_8(:,1)],...
[edge_powers_2(:,2),edge_lpr_2(:,2),...
edge_powers_4(:,2),edge_lpr_4(:,2),...
edge_powers_8(:,2),edge_lpr_8(:,2)],'input_type','samp',...
'dom',results_all.samp_opt_bd,'samp_opt',false);
xlabel('$q_s(${\boldmath$x$}$)$ (2, 4 and 8px)','interpreter','latex');
axis([-125 150 0 .015])